
browser=navigator.appName;

//=====Set Onload windows from folder-tree.js========
function setOnload(){
	initTree();	 //create folder tree
	hideUrl();
	//showMainpage();
}

//======popup windows=========
function MM_openBrWindow(theURL,winName) { //v2.0
	window.open(theURL,winName,'status=1,scrollbars=1,resizable=1,width=450,height=300');
}

//======popup windows=========
function MM_openBrWindow2(theURL,winName) { //v2.0
	window.open(theURL,winName,'status=1,scrollbars=1,resizable=1,width=700,height=400');
}

//======popup FlashGame=========
function MM_openFalshGame(game,winName) { //v2.0
	theURL = "template/playGames.php?file="+game;
	window.open(theURL,winName,'status=0,scrollbars=0,resizable=0,width=600,height=400');
}

//=====Hide Url =====
/*
if (document.layers)
document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)
document.onmouseover=hideUrl
document.onmouseout=hideUrl
*/
//======set status bar=======
function hideUrl(){
			window.status="www.MobiFan.com , wap.MobiFan.com : The Ultimate Fun on Mobile";
			return true; 
} 

// FUNCTION CALL IN FILE music_how2dl.php
function getHowToData( SourceTag, DescTag, dataCode, mediatype){
		var objDesc = document.getElementById(DescTag);
		var objSource = document.getElementById(SourceTag);
		strObj = objSource.innerHTML;
		
		strObj = strObj.replace(/{Mediatype}/g, mediatype);
		objDesc.innerHTML = strObj.replace(/{DataCode}/g, dataCode);
		
		document.getElementById('dw').style.display="none";

		if(SourceTag=='dw'){
			document.getElementById('divServiceCharge').style.display="block";
			document.getElementById('ContentScor').style.overflow = 'auto' ;
		}else if(SourceTag=='sf'){
			document.getElementById('divServiceCharge').style.display="block";
			document.getElementById('ContentScor').style.overflow = 'auto' ;
		}else{
			document.getElementById('divServiceCharge').style.display="none";
			document.getElementById('ContentScor').style.overflow = 'hidden' ;
		}
}

/********************************************************
*************Chage Display Picture For prv_campaign.php***************
*********************************************************/
function chgDisplay(dvName,pic){
	dv= document.getElementById(dvName);
	dv.innerHTML = "<img src='"+pic+"' />";
}

function nav(arrName,pageName,Max,dvName,id,flg){
		var dv= document.getElementById(dvName);
		var arr = document.getElementById(arrName).value.split(":");
		var page = document.getElementById(pageName).value;
		var option = "";
		var tmp=0
		var strImg="";
		if(arr.length % Max != 0 ) tmp = 1;
		maxPage = parseInt(arr.length/Max)+tmp;
		if(flg=="Next"){
			page = parseInt(page)+1;
		}else{
			page = parseInt(page)-1;
		}
		if( page >0 && page <= maxPage ){
			document.getElementById(pageName).value = page;
			start = (page*Max)-Max;
			end = start+Max;
			for(i = start; i<arr.length;i++){
					strImg+="<img src='image/campaign/"+arr[i]+"' width='50' height='50' onclick=\"chgDisplay('imgCampaign"+id+"','image/campaign/"+arr[i]+"');\" style='cursor:hand;' border='1'/>&nbsp;";
					if(i == end-1) break; 
			}
			dv.innerHTML = strImg;
		}		
}

/*********************************************
*************Create shadow Background image***************
*********************************************/
/*
var gradientshadow={}
gradientshadow.depth=6 //Depth of shadow in pixels
gradientshadow.containers=[]

gradientshadow.create=function(){
var a = document.all ? document.all : document.getElementsByTagName('*')
for (var i = 0;i < a.length;i++) {
	if (a[i].className == "shadow") {
		for (var x=0; x<gradientshadow.depth; x++){
			var newSd = document.createElement("DIV")
			newSd.className = "shadow_inner"
			newSd.id="shadow"+gradientshadow.containers.length+"_"+x //Each shadow DIV has an id of "shadowL_X" (L=index of target element, X=index of shadow (depth) 
			if (a[i].getAttribute("rel"))
				newSd.style.background = a[i].getAttribute("rel")
			else
				newSd.style.background = "black" //default shadow color if none specified
			document.body.appendChild(newSd)
		}
	gradientshadow.containers[gradientshadow.containers.length]=a[i]
	}
}
gradientshadow.position()
window.onresize=function(){
	gradientshadow.position()
}
}

gradientshadow.position=function(){
if (gradientshadow.containers.length>0){
	for (var i=0; i<gradientshadow.containers.length; i++){
		for (var x=0; x<gradientshadow.depth; x++){
  		var shadowdiv=document.getElementById("shadow"+i+"_"+x)
			shadowdiv.style.width = gradientshadow.containers[i].offsetWidth + "px"
			shadowdiv.style.height = gradientshadow.containers[i].offsetHeight + "px"
			shadowdiv.style.left = gradientshadow.containers[i].offsetLeft + x + "px"
			shadowdiv.style.top = gradientshadow.containers[i].offsetTop + x + "px"
		}
	}
}
}

if (window.addEventListener)
window.addEventListener("load", gradientshadow.create, false)
else if (window.attachEvent)
window.attachEvent("onload", gradientshadow.create)
else if (document.getElementById)
window.onload=gradientshadow.create


/*********************************************
*************protect for right click***************
*********************************************/
/*
	var message="";
	function clickIE() {if (document.all) {(message);return false;}}
	function clickNS(e) {if 
	(document.layers||(document.getElementById&&!document.all)) {
	if (e.which==2||e.which==3) {(message);return false;}}}
	if (document.layers) 
	{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
	else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
	
	document.oncontextmenu=new Function("return false")

function disableselect(e){
return false
}

function reEnable(){
return true
}

//if IE4+
document.onselectstart=new Function ("return false")

//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
document.onkeydown=reEnable
}


var isNS = (navigator.appName == 'Netscape') ? 1 : 0;
var EnableRightClick = 0;
if(isNS) 
document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP);
function mischandler(){
  if(EnableRightClick==1){ return true; }
  else {return false; }
}
function mousehandler(e){
  if(EnableRightClick==1){ return true; }
  var myevent = (isNS) ? e : event;
  var eventbutton = (isNS) ? myevent.which : myevent.button;
  if((eventbutton==2)||(eventbutton==3))
  return false;
}
function keyhandler(e) {
  var myevent = (isNS) ? e : window.event;
  if (event.keyCode==116) 
	myevent.keyCode = 0;
  return false;
}
document.oncontextmenu = mischandler;
document.onkeydown = keyhandler;
document.onmousedown = mousehandler;
document.onmouseup = mousehandler;
*/