// JavaScript Document
var h1swapcount = 0
function hlswap() 
{  var ttsize, altsize, ulnum
	harr = document.getElementById("everything").getElementsByTagName("h1")
	for(i=0;i<harr.length;i++)
	{ 
		if(harr[i].className.indexOf("fltxt")>-1)
		{ //alert(harr[i].innerHTML); 
		  
		  hlopts = ["sz","ul"]; hlval = new Array();
		  for(ix=0;ix<hlopts.length;ix++)
		  { if((svar = harr[i].className.indexOf(hlopts[ix]+"."))>-1){ hlval[ix] = String(harr[i].className).slice(svar+3,svar+5);  }  } 
		  altsize = hlval[0]; ulnum = (hlval[1])?Number(hlval[1]):1;
		  if(svar = harr[i].getElementsByTagName("a")[0]){ turl = svar.href }
			harr[i].className = "flh"			
			tstr = harr[i]
			strt = tstr.getElementsByTagName("span")[0].innerHTML
			strt.replace("&lt;br /&gt;","\n");
			hpadd = (altsize)?altsize-20:0
			var so = new SWFObject(ctx+"_flash/blizzcast/title.swf", "flsh"+(++h1swapcount), "100%", 30+hpadd, "8");
			so.addParam("base", ctx+"_flash/blizzcast/"); 
			so.addParam("wmode", "transparent"); 
			strt += ":"+0 //ulnum 
			strt += ":"+altsize 
			strt += ":"+(lang.split("_")[0])+"-"+(lang.split("_")[1]).toUpperCase();
			so.addVariable("strtitle", strt)
			so.write(tstr);   
		} 
	}
}

function player()
{
			
			var so = new SWFObject(ctx+"_flash/blizzcast/flvplayer.swf", "flplayer", 392, 95, "8");
			so.addParam("base", ctx+"_flash/blizzcast/"); 
			so.addParam("wmode", "transparent"); 
			so.addVariable("showtext", eptxt)
			so.write("flv");   
}

function showvideo(flv,img,dir,w,h,targ)
{
			
			var so = new SWFObject(ctx+"_flash/blizzcast/video_loader.swf", targ+"-id", w, h, "9");
			so.addParam("base", ctx+"_flash/blizzcast/"); 
			so.addParam("allowScriptAccess", "always");
			so.addParam("allowFullScreen", "true");
			so.addVariable("vidArr", flv+":"+img+":"+dir)
			so.write(targ);   
}


// Lang Cookie

function dropdownMenuToggle(whichOne){
	theStyle = document.getElementById(whichOne).style;

	if (theStyle.display == "none") {
		theStyle.display = "block";	
	} else
		theStyle.display = "none";
}


function selectLang(theDisplay, cookieValue) {
	document.getElementById("dropdownHiddenLang").style.display = "none";
	document.getElementById("displayLang").innerHTML = theDisplay;
//	setcookie("cookieLangId", cookieValue, ""); 
	/*
  	if(cookieValue == "en_us") {
    	document.location.href="http://www.worldofwarcraft.com"+roothost;
  	} else if(cookieValue == "ko_kr") {
    	document.location.href="http://www.worldofwarcraft.co.kr"+roothost;
  	} else {
    	document.location.href="http://www.wow-europe.com"+roothost;
  	}
	*/
	windowloc = window.location.href
	windowloc = (windowloc.indexOf("#")>-1)?windowloc.slice(0,windowloc.indexOf("#")):windowloc
	window.location.href=  windowloc + "?locale=" +cookieValue//reload();
	
	/*
		document.getElementById("dropdownHiddenLang").style.display = "none";
	document.getElementById("displayLang").innerHTML = theDisplay;
  	setcookie("cookieLangId", cookieValue, "");
  	
	if(cookieValue == "en_us") {
    	document.location.href="http://www.worldofwarcraft.com"+roothost;
  	} else if(cookieValue == "ko_kr") {
    	document.location.href="http://www.worldofwarcraft.co.kr"+roothost;
  	} else {
    	document.location.href="http://www.wow-europe.com"+roothost;
  	}
	
	//document.location.reload();
	*/
	
	
	
	
	
}

function getexpirydate(nodays){
	var UTCstring;
	Today = new Date();
	nomilli=Date.parse(Today);
	Today.setTime(nomilli+nodays*24*60*60*1000);
	UTCstring = Today.toUTCString();
	return UTCstring;
}

function getcookie(cookiename) {
	 var cookiestring=""+document.cookie;
	 var index1=cookiestring.indexOf(cookiename);
	 if (index1==-1 || cookiename=="") return ""; 
	 var index2=cookiestring.indexOf(';',index1);
	 if (index2==-1) index2=cookiestring.length; 
	 return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
}

function setcookie(name,value,expire,domain){
	var expireString="EXPIRES="+ getexpirydate(365)+";"
	var domainString="DOMAIN="+ domain
	if(expire=="session")
		expireString="";
	if(!domain)
		domainString="";		
	cookiestring=name+"="+escape(value)+";"+expireString+"PATH=/;"+domainString;
	document.cookie=cookiestring;
	
}