// 6/28 glovalv02.inc and topstory.xsl  changed to write javascript ad functions
var br = 1;
var grab=false;
var newwindow;
//var AD = new Array();
function UGOinit() {
	var ugoinit = true;
}

function executeSearch(){
	document.SmallSearchForm.submitme.value = "1";
	document.SmallSearchForm.submit();
}
function unhide_300x50() {
	try{
		var unhide = document.getElementById("AD300x50")
		unhide.style.display="block"
	} catch(e) {
		window.status = "hmmm"
	}
}
		
function executeGameSearch(){
	document.GameSearchForm.submitme.value = "1";
	document.GameSearchForm.submit();
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}

		
function menuChange(obj) {
	var url=obj[obj.selectedIndex].value;
	var mywin=window.location.href=url;
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
	document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
		
function toggle(targetId){
  if (document.getElementById){
		target = document.getElementById(targetId);
			if (target.style.display == "none"){
				target.style.display = "block";
			} 
			else if (target.style.display == ""){
				target.style.display = "block";
			}
			else {
				target.style.display = "none";
			}
	}

}
		
function toggleOn(targetId){
	if (document.getElementById){
		target = document.getElementById(targetId);
		if (target.style.display == "none"){
			target.style.display = "block";
		} else if (target.style.display == ""){
			target.style.display = "block";
		}
	}
}

function hide(targetId){
	if (document.getElementById){
		target = document.getElementById(targetId);		  			
		target.style.display = "none";
	}
}

function switchBTN(target1, target2, target1b, target2b)  {
	hide( target1 );	
	toggleOn( target2 );
	target = document.getElementById( target2b  );
	target.className = 'open';			
	target = document.getElementById( target1b  );
	target.className = 'closed';
}
	
function show(url,href) {
	target = document.getElementById('videoimage');
	target.src = url;
	target = document.getElementById('videoimage-rollover');
	target.href = href;
}

function popgallery(galleryName) {						
	window.open('http://www.ugo.com/modules/global/gallery/default.asp?gallery='+galleryName,'ImageGallery','status=yes,scrollbars=yes,width=750,height=770');
}	

function popvideo(videoID) {		
	vidpop(videoID);
}

function bHasWindow(wnd) {
	var bOpen = true;
	if(wnd == null) {
		return false;
	}
	return bOpen;
}


function vidpop() {
	var ref="";
	var args = vidpop.arguments;
	this.id = args[0];
	this.cat = args[1];
	if(args.length > 2) {
		this.ref = args[2];
		ref="&ref="+this.ref;
	}
	if (this.id > 0) {
		if (this.cat == "UGO Players") {
			var url = 'http://video.ugo.com/ugoplayers/?articleID='+this.id+ref;
		} else {	
			var url = 'http://video.ugo.com/player.aspx?articleID='+this.id+ref;
		}
	} else {
		var url = 'http://video.ugo.com/player.aspx?articleID='+this.id+ref;
	}
	newwindow= window.open(url,'UGOVideo','status=no,scrollbars=no,width=740,height=590');
	if (!bHasWindow(newwindow)) {
		alert('you need to disable popup blocking to view this video.');
	} else {
		newwindow.focus();		
	}
}

function vidpopaff(id,logo) {
	var url = 'http://video.ugo.com/player.aspx?articleID='+id+'&ce='+logo
	newwindow = window.open(url,'UGOVideo','status=no,scrollbars=no,width=740,height=590');
	newwindow.focus();
}

function popvideounit(videoID) {
	vidpop(videoID);
}

function stf(vals) {
	stfurl='http://www.ugo.com/modules/global/stf/sendlink.asp?args='+vals;
window.open(stfurl,'SendToFriend','status=no,scrollbars=no,width=233,height=380');
}

function contact() {
	var vals = document.title;
	conurl='/modules/global/contact/form.asp?args='+vals+'&ref='+window.location;
	window.open(conurl,'ContactUGO','status=no,scrollbars=no,width=433,height=370');
}

function toyVideo(theURL) {		
	window.open(theURL,'videoPlayer','status=yes,scrollbars=no,width=729,height=490');		
}

function newVideo(theURL) {		
	window.open(theURL,'videoPlayerX','status=yes,scrollbars=no,width=520,height=440');		
}
		
function gallery(theURL) {						
	window.open(theURL,'ImageGallery','status=yes,scrollbars=yes,width=750,height=770');
}

function customGallery(theURL,w,h) {
	strParams = 'status=yes,scrollbars=yes,width='+w+',height='+h
	window.open(theURL,'ImageGallery',strParams);
}

function popvideoURL(videoURL) {		
	window.open('http://www.ugo.com/modules/channel/video/player/playerURL.asp?vurl='+videoURL,'UGOVideo','status=yes,scrollbars=yes,width=410,height=380');		
}

function on300x250() {

}

function getVars(varname){
	// window.document.subfooter.SetVariable(varname, eval(varname));    
	document.getElementById("subfooter").setVariable(varname, eval(varname));
}
