// flashWrite(url, width, height, id, bg, window)
function flashWrite(url,w,h,id,bg,win){

	var flashStr=
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
	"<param name='allowScriptAccess' value='always' />"+
	"<param name='movie' value='"+url+"' />"+
	"<param name='wmode' value='"+win+"' />"+
	"<param name='menu' value='false' />"+
	"<param name='quality' value='high' />"+
	"<param name='bgcolor' value='"+bg+"' />"+
	"<embed src='"+url+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
	"</object>";

	document.write(flashStr);

}

// SubLeftMenu //
function ContMenu(num){
	var viewLayer = document.getElementById("Togmenu"+num);
	var viewm = document.getElementById("Menu"+num);

	if (viewLayer.style.display=="block"){
		viewLayer.style.display="none";
		viewm.className = viewm.className.replace("menu", "menu_active");

		}else{
		viewLayer.style.display="block";
		viewm.className = viewm.className.replace("menu_active", "menu");
	}
}


// Top Navi //
function initnav(obj) {
	hideElements = new Array();
	var av = navigator.appVersion.toLowerCase();
	var platform;
	if (av.indexOf("mac") != -1) {
		platform = "mac";
	} else if (av.indexOf("windows") != -1) {
		platform = "win";
	}
	var isIE = (navigator.appName == "Microsoft Internet Explorer");
	if (document.getElementById && document.getElementById(obj)) {
		navRoot = document.getElementById(obj);
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.offsetLeft > 1004) {
				var adjust = 1004-node.offsetLeft;
				for (var j=0; j<node.childNodes.length; j++) {
					if (node.childNodes[j].nodeName.toUpperCase() == 'UL') {
						node.childNodes[j].style.left = adjust+'px';
					}
				}
			}
			node.onmouseover = function() {
				if (this.className.indexOf('onmenu') != -1) {
					if (this.className.indexOf('solid') != -1) {
						this.className = 'onmenu_off solid';
					} else {
						this.className = 'onmenu_off';
					}
					if (isIE) {
						for (e=0; e<hideElements.length; e++) {
							var formElem = document.getElementById(hideElements[e].id);
							if (formElem != null) {
								formElem.style.visibility = 'hidden';
							}
						}
					}
				}
			}
			node.onmouseout = function() {
				if (this.className.indexOf('onmenu_off') != -1) {
					if (this.className.indexOf('solid') != -1) {
						this.className = 'onmenu solid';
					} else {
						this.className = 'onmenu'
					}
					if (isIE) {
						for (e=0; e<hideElements.length; e++) {
							var formElem = document.getElementById(hideElements[e].id);
							if (formElem != null) {
								formElem.style.visibility = 'visible';
							}
						}
					}
				}
			}
		}
	}
	
	if (navigator.appName == "Microsoft Internet Explorer" && platform != "mac") {
		isIE = true;
		//window.attachEvent("onload", findForm);		//removed by sean 20090217
		//window.onload = findForm;
	}
}
// Top Navi //


// tab //
function initTabMenu(tabContainerID) {
	var tabContainer = document.getElementById(tabContainerID);
	var tabAnchor = tabContainer.getElementsByTagName("a");
	var i = 0;
	for(i=0; i<tabAnchor.length; i++) {
		if (tabAnchor.item(i).className == "over_tab")
			thismenu = tabAnchor.item(i);
		else
			continue;
		thismenu.container = tabContainer;
		thismenu.targetEl = document.getElementById(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		thismenu.onclick = function tabMenuClick() {
			currentmenu = this.container.current;
			if (currentmenu == this)
				return false;
			if (currentmenu) {
				currentmenu.targetEl.style.display = "none";
				currentmenu.className = currentmenu.className.replace("over_tab_on", "over_tab");
			}
			this.targetEl.style.display = "";
			this.className = this.className.replace("over_tab", "over_tab_on");
			this.container.current = this;
			return false;
		};
		if (!thismenu.container.first)
			thismenu.container.first = thismenu;
	}
	if (tabContainer.first)
		tabContainer.first.onclick();
}

function tabOverView(id,subId){
	var objMenu = document.getElementById(id);
	var subMenu = document.getElementById(subId);
	objMenu.onmouseover = function(){ subMenu.style.display="block"; }
	objMenu.onmouseout = function(){ subMenu.style.display="none"; }
}

function map_swf(flashVars){
	// Flash Code Define
	var flashStr=
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='240' height='165' id='FlashVars' align='middle' />"+
	"<param name='allowScriptAccess' value='sameDomain' />"+
	"<param name='movie' value='/img/guides/map_guide.swf' />"+
	"<param name='FlashVars' value='"+flashVars+"' />"+
	"<param name='loop' value='false' />"+
	"<param name='menu' value='false' />"+
	"<param name='quality' value='high' />"+
	"<param name='scale' value='noscale' />"+
	"<param name='bgcolor' value='#fffbed' />"+
	"<param name='wmode' value='transparent' />"+
	"<embed src='/img/guides/map_guide.swf' FlashVars='"+flashVars+"'  quality='best' bgcolor='#fffbed' width='240' height='165' name='FlashVars' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
	"</object>";

	// Flash Code Output
	document.write(flashStr);
};

function map_swf_trick(flashVars){
	document.getElementById("trick_movie").innerHTML=
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='240' height='185' id='FlashVars' align='middle' />"+
	"<param name='allowScriptAccess' value='sameDomain' />"+
	"<param name='movie' value='/img/guides/map_guide.swf' />"+
	"<param name='FlashVars' value='"+flashVars+"' />"+
	"<param name='loop' value='false' />"+
	"<param name='menu' value='false' />"+
	"<param name='quality' value='high' />"+
	"<param name='wmode' value='transparent' />"+
	"<param name='bgcolor' value='#fff' />"+
	"<param name='scale' value='noscale' />"+
	"<embed src='/img/guides/map_guide.swf' FlashVars='"+flashVars+"' quality='best' wmode='opaque' width='240' height='185' bgcolor='#fff' name='FlashVars' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
	"</object>";
};

// Map
function imgon_tab(tabContainerID) {
	var tabContainer = document.getElementById(tabContainerID);
	var tabAnchor = tabContainer.getElementsByTagName("a");
	var i = 0;

	for(i=0; i<tabAnchor.length; i++) {
		if (tabAnchor.item(i).className == "thum")
			thismenu = tabAnchor.item(i);
		else
			continue;
		thismenu.container = tabContainer;
		thismenu.targetEl = document.getElementById(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		thismenu.onclick = function tabMenuClick() {
			currentmenu = this.container.current;
			if (currentmenu == this)
				return false;
			if (currentmenu) {
				currentmenu.targetEl.style.display = "none";
			}
			this.targetEl.style.display = "";
			this.container.current = this;
				return false;
		};
		if (!thismenu.container.first)
			thismenu.container.first = thismenu;
	}
	if (tabContainer.first)
		tabContainer.first.onclick();
}

function downClick(loggedIn,dntype){
	if(loggedIn){
		window.open('/support/download_file/?dntype='+dntype);
	}else{
		loc = location.href;
		Set_Cookie('origin',loc,0,'/','.outspark.com',0);
		location.href='https://login.outspark.com/?redirect='+encodeURIComponent(loc);
	}
}

function Set_Cookie( name, value, expires, path, domain, secure ) {
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );
	
	/*
	if the expires variable is set, make the correct 
	expires time, the current script below will set 
	it for x number of days, to make it for hours, 
	delete * 24, for minutes, delete * 60 * 24
	*/
	if ( expires )	{
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	
	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
	( ( path ) ? ";path=" + path : "" ) + 
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
}

/* game-navi */

function getDoffset(obj){
	var pos=[0,0];
	if(obj.offsetParent){
		do{
			pos[0] += obj.offsetLeft;
			pos[1] += obj.offsetTop;
		}while(obj = obj.offsetParent);
	}
	return pos;
}

var gamenavi = {
	contain : null,obj : null, itemList : [], subMr : 6, repeat : null,
	set : function(contain){
		gamenavi.contain = contain;
		for(d1=0,i=0;i<gamenavi.contain.childNodes.length;i++){
			if(gamenavi.contain.childNodes[i].nodeType==1){
				gamenavi.itemList[d1] = gamenavi.contain.childNodes[i];
				gamenavi.itemList[d1].d1a = gamenavi.itemList[d1].getElementsByTagName("a")[0];
				gamenavi.itemList[d1].onmouseover = gamenavi.view;
				gamenavi.itemList[d1].onmouseout = function(){ this.className=""; if(this.d2!=null) this.d2.style.display="none" }
				gamenavi.itemList[d1].d2 = (gamenavi.itemList[d1].getElementsByTagName("div").length > 0) ? gamenavi.itemList[d1].getElementsByTagName("div")[0] : null;
				if(gamenavi.itemList[d1].d2!=null){
					gamenavi.itemList[d1].d2.w = gamenavi.itemList[d1].d2.offsetWidth;
					gamenavi.itemList[d1].d2.style.display = "none";
				}

				d1++;
			}
		}
	},
	view : function(obj){
		this.className="on";
		if(this.d2!=null){ 
			this.d2.style.display="block";
			this.d2.style.top = getDoffset(gamenavi.contain)[1]+gamenavi.contain.offsetHeight+"px";
			this.d2.style.left = getDoffset(this)[0]+(this.offsetWidth/2)-(this.d2.w/2)+"px";
		}
	}
}

function menuon(obj){}		//for poll js
function menuout(obj){}		//for poll js