var debugCount=0;
function setPermLink(hash)
{
	//document.getElementById('debug').innerHTML=debugCount+' '+hash
	//debugCount++;
	//document.location.hash=hash;
}

$(document).ready(function(){
	setTimeout('loadVidPlayer()',500);
	$('#scetclick').click(function(){
		setScet('scet');
	})

	$('#scetfull').click(function(){
		setScet('full');
	});
	checkCookie();
});
	
function checkCookie(){
	if($.cookie('sn_nbc_b') != null){
	var c = $.cookie('sn_nbc_b').split('|');
	var sn_name = c[1].split(',');
			// alert(sn_name[0]);
		return sn_name[0];
		}
		else{return false;}	
}

var setScet = function(type) {
	if(type =='scet'){
	 $('div#main').animate({height: '190px'},"fast");
		$('div#scet').toggle();
		//set the embed player to have wmode which default it should not be
		// $('div#vid-main-player embed').attr({wmode:'transparent'});
	}
	if(type =='full'){
		$('div#main').animate({height: '710px'},"fast");
		$('div#scet').hide();
	}
}

var setRewindHdrOpc = function(alpha){
	$('div#vid-header').fadeTo('normal',alpha);
}

var setRewindHdr = function(arg) {
	if(arg)
	{
		$('div#vid-header').animate({height: 'show'}, "slow");	
	} else {
		$('div#vid-header').animate({height: 'hide', opacity: 'toggle'}, "slow");
	}

}
var setRewindCol = function(){
	$('div#vid-chat').animate({width:'toggle'}, "slow");
}

//Loading the flash videoplayer
var loadVidPlayer = function(){
	var browserSniff   = $.browser.msie;
	if(!browserSniff) 
	{ 
		$('#vid-main-player').media({
			width:971, 
			height:710,
			autoplay: true, 
			src:'/Video/rewindpl2_heroes_08_07_07.swf?vid=142053',
			allowScriptAccess: 'always',
			allowFullscreen: 'true',
			bgcolor:'#000000',
			align:"middle",
			attrs:{allowScriptAccess: 'always', allowFullscreen: 'true', align:"middle"},
			params:{allowScriptAccess: 'always', allowFullscreen: 'true', align:"middle"},
			caption: false
		});

		// $('#vid-chat').media({
		// 							width:255, 
		// 							height:700,
		// 							autoplay: true, 
		// 							src:'rewindpl2.swf',
		// 							allowScriptAccess: 'always',
		// 							allowFullscreen: 'true',
		// 							bgcolor:'#000000',
		// 							attrs:{allowScriptAccess: 'always', allowFullscreen: 'true', bgcolor:'#000000'},
		// 							params:{allowScriptAccess: 'always', allowFullscreen: 'true', bgcolor:'#000000'},
		// 							caption: false
		// 								});
		$('#scet-vp').media({
			width:663, 
			height:346,
			autoplay: true, 
			src:'scetPLAYER.swf',
			allowScriptAccess: 'always',
			allowFullscreen: 'true',
			bgcolor:'#000000',
			attrs:{allowScriptAccess: 'always', allowFullscreen: 'true', bgcolor:'#000000'},
			params:{allowScriptAccess: 'always', allowFullscreen: 'true', bgcolor:'#000000'},
			caption: false
		});
		$('#scet-comm').media({
			width:971, 
			height:328,
			autoplay: true, 
			src:'scetcomments.swf',
			allowScriptAccess: 'always',
			allowFullscreen: 'true',
			bgcolor:'#000000',
			attrs:{allowScriptAccess: 'always', allowFullscreen: 'true', bgcolor:'#000000', wmode:"opaque"},
			params:{allowScriptAccess: 'always', allowFullscreen: 'true', bgcolor:'#000000', wmode:"opaque"},
			caption: false
		});
	}
}

// refresh ads
var refreshAd = function(mode){
	switch(mode)
	{
		case 'all':
			//rw_ad_1x1_frame.document.location.reload();
			//setTimeout('rw_ad_728x90_frame.document.location.reload();',2000);
			break;
		case '728x90':
			//rw_ad_728x90_frame.document.location.reload();
			break;
	}
	
}

// Add Ops
var adOps1x1 = function(){
		var sFrame1x1 = '<iframe id="rw_ad_1x1_frame" name="rw_ad_1x1_frame" src="includes/1x1.html" frameborder="0" width="1" height="1" marginheight="0" marginwidth="0" scrolling="no"></iframe>';
		$('#rw-ad-1x1').append(sFrame1x1);
		return true;
	}
	
var adOps728x90 = function(){
		var sFrame728x90 = '<iframe id="rw_ad_728x90_frame" name="rw_ad_728x90_frame"src="includes/728x90.html" frameborder="0" width="728" height="90" marginheight="0" marginwidth="0" scrolling="no"></iframe>';
		$('#rw-ad-728x90').append(sFrame728x90);
		return true;
	}

