function startSite(){
	//Loading GUI
	//Header DIV
	//document.getElementById("pHead").innerHTML = "<img src=\"" + templateDir + "img/head.jpg\" border=\"0\">";
	
	//MainData DIV
	//document.getElementById("mainData").style.backgroundColor = "#f9f9f9";
}

function startBanner02(){
	document.getElementById("banner02").innerHTML = "<img src=\"" + templateDir + "img/Sponsor_Banner_2_1.gif\" border=\"0\">";
	setTimeout("startBanner02_1()", 5000);
}

function startBanner02_1(){
	document.getElementById("banner02").innerHTML = "<img src=\"" + templateDir + "img/Sponsor_Banner_2_2.gif\" border=\"0\">";
	setTimeout("startBanner02_2()", 500);
}

function startBanner02_2(){
	document.getElementById("banner02").innerHTML = "<img src=\"" + templateDir + "img/Sponsor_Banner_2_3.gif\" border=\"0\">";
	setTimeout("startBanner02_3()", 5000);
}

function startBanner02_3(){
	document.getElementById("banner02").innerHTML = "<img src=\"" + templateDir + "img/Sponsor_Banner_2_2.gif\" border=\"0\">";
	setTimeout("startBanner02()", 500);
}

function startBannerHome(){
	clearTimeout(homeBanner);
	document.getElementById("bannerHP").innerHTML = "<img src=\"" + templateDir + "img/home_banner04.jpg\" border=\"0\" usemap=\"#map04\">";
	document.getElementById("circleHP01").innerHTML = "<img onMouseOver=\"javascript:startBannerHome();\" src=\"" + templateDir + "img/circleFull.gif\" border=\"0\">";
	document.getElementById("circleHP02").innerHTML = "<img onMouseOver=\"javascript:startBannerHome02();\" src=\"" + templateDir + "img/circleEmpty.gif\" border=\"0\">";
	document.getElementById("circleHP03").innerHTML = "<img onMouseOver=\"javascript:startBannerHome03();\" src=\"" + templateDir + "img/circleEmpty.gif\" border=\"0\">";
	document.getElementById("circleHP04").innerHTML = "<img onMouseOver=\"javascript:startBannerHome04();\" src=\"" + templateDir + "img/circleEmpty.gif\" border=\"0\">";
	homeBanner = setTimeout("startBannerHome02()", 8000);
}

function startBannerHome02(){
	clearTimeout(homeBanner);
	document.getElementById("bannerHP").innerHTML = "<img src=\"" + templateDir + "img/home_banner01.gif\" border=\"0\" usemap=\"#map01\">";
	document.getElementById("circleHP01").innerHTML = "<img onMouseOver=\"javascript:startBannerHome();\" src=\"" + templateDir + "img/circleEmpty.gif\" border=\"0\">";
	document.getElementById("circleHP02").innerHTML = "<img onMouseOver=\"javascript:startBannerHome02();\" src=\"" + templateDir + "img/circleFull.gif\" border=\"0\">";
	document.getElementById("circleHP03").innerHTML = "<img onMouseOver=\"javascript:startBannerHome03();\" src=\"" + templateDir + "img/circleEmpty.gif\" border=\"0\">";
	document.getElementById("circleHP04").innerHTML = "<img onMouseOver=\"javascript:startBannerHome04();\" src=\"" + templateDir + "img/circleEmpty.gif\" border=\"0\">";
	homeBanner = setTimeout("startBannerHome03()", 8000);
}

function startBannerHome03(){
	clearTimeout(homeBanner);
	document.getElementById("bannerHP").innerHTML = "<img src=\"" + templateDir + "img/home_banner02.gif\" border=\"0\" usemap=\"#map02\">";
	document.getElementById("circleHP01").innerHTML = "<img onMouseOver=\"javascript:startBannerHome();\" src=\"" + templateDir + "img/circleEmpty.gif\" border=\"0\">";
	document.getElementById("circleHP02").innerHTML = "<img onMouseOver=\"javascript:startBannerHome02();\" src=\"" + templateDir + "img/circleEmpty.gif\" border=\"0\">";
	document.getElementById("circleHP03").innerHTML = "<img onMouseOver=\"javascript:startBannerHome03();\" src=\"" + templateDir + "img/circleFull.gif\" border=\"0\">";
	document.getElementById("circleHP04").innerHTML = "<img onMouseOver=\"javascript:startBannerHome04();\" src=\"" + templateDir + "img/circleEmpty.gif\" border=\"0\">";
	homeBanner = setTimeout("startBannerHome04()", 8000);
}

function startBannerHome04(){
	clearTimeout(homeBanner);
	document.getElementById("bannerHP").innerHTML = "<img src=\"" + templateDir + "img/home_banner03.gif\" border=\"0\" usemap=\"#map03\">";
	document.getElementById("circleHP01").innerHTML = "<img onMouseOver=\"javascript:startBannerHome();\" src=\"" + templateDir + "img/circleEmpty.gif\" border=\"0\">";
	document.getElementById("circleHP02").innerHTML = "<img onMouseOver=\"javascript:startBannerHome02();\" src=\"" + templateDir + "img/circleEmpty.gif\" border=\"0\">";
	document.getElementById("circleHP03").innerHTML = "<img onMouseOver=\"javascript:startBannerHome03();\" src=\"" + templateDir + "img/circleEmpty.gif\" border=\"0\">";
	document.getElementById("circleHP04").innerHTML = "<img onMouseOver=\"javascript:startBannerHome04();\" src=\"" + templateDir + "img/circleFull.gif\" border=\"0\">";
	homeBanner = setTimeout("startBannerHome()", 8000);
}

function GetXmlHttpObject(){
  var xmlHttp = null;
  try{
    // Firefox, Opera 8.0+, Safari
    xmlHttp = new XMLHttpRequest();
    }
  catch (e){
    // Internet Explorer
    try{
      xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e){
      xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
      }
    }
  return xmlHttp;
}

function stateChanged001(){
	if (xmlHttp001.readyState == 4){
		window.location.href = "home.php";
	}
}

function stateChanged001a(){
	if (xmlHttp001.readyState == 4){ 
		document.getElementById("mainDataDx").innerHTML = xmlHttp001.responseText;
	}
}

function stateChanged001b(){
	if (xmlHttp001.readyState == 4){ 
		document.getElementById("menuCatSx").innerHTML = xmlHttp001.responseText;
	}
}

function changeLang(fnLangID,fnPageRef){
//	xmlHttp001=GetXmlHttpObject()
//	if (xmlHttp001==null){
//		alert ("Your browser does not support AJAX!");
//		return;
//	} 
	var url = "wChangeLang.php";
	url = url+"?sid=" + Math.random();
	url = url+"&newLangID=" + fnLangID;
	url = url+"&pageRef=" + fnPageRef;
	
	window.location.href = url;
	
//	xmlHttp001.onreadystatechange = stateChanged001;
//	xmlHttp001.open("GET", url, true);
//	xmlHttp001.send(null);
}

function changeMSx(elementDiv,elementState){
	if(elementState=='1'){
		elementDiv.style.backgroundColor = "#f9f9f9";
		elementDiv.style.color = "#FFFFFF";
	} else {
		elementDiv.style.backgroundColor = "#f9f9f9";
		elementDiv.style.color = "#3a7b9a";
	}
}

function changeCSx(elementDiv,elementState){
	if(elementState=='1'){
		elementDiv.style.color = "#FFFFFF";
		elementDiv.style.textDecoration = "underline";
		//elementDiv.style.backgroundColor = "#f9f9f9";
		/*elementDiv.style.border = "1px solid #000000";*/
		//elementDiv.innerHTML = "- " + elementDiv.innerHTML + " -";
	} else {
		elementDiv.style.color = "#FFFFFF";
		elementDiv.style.textDecoration = "none";
		/*
		stringTmp = elementDiv.innerHTML;
		stringTmp = stringTmp.substr(1);
		stringTmp = stringTmp.substr(0, (stringTmp.length-2));
		elementDiv.innerHTML = stringTmp;
		*/
		//elementDiv.style.backgroundColor = "#f9f9f9";
		/*elementDiv.style.border = "1px solid #FFFFFF";*/
	}
}

function changeCSx2(elementDiv,elementState){
	if(elementState=='1'){
		elementDiv.style.color = "#111111";
		elementDiv.style.textDecoration = "underline";
	} else {
		elementDiv.style.color = "#111111";
		elementDiv.style.textDecoration = "none";
	}
}

function newsSite(fnLangID,numTotEl){
//	xmlHttp001=GetXmlHttpObject()
//	if (xmlHttp001==null){
//		alert ("Your browser does not support AJAX!");
//		return;
//	} 
	var url = templateDir + "newsList.php";
	url = url+"?sid=" + Math.random();
	url = url+"&langID=" + fnLangID;
	
	window.location.href = url;
	
//	xmlHttp001.onreadystatechange = stateChanged001a;
//	xmlHttp001.open("GET", url, true);
//	xmlHttp001.send(null);
//	emptyMenu(numTotEl);
}

function viewNewsPage(newsID,fnLangID){
	xmlHttp001=GetXmlHttpObject()
	if (xmlHttp001==null){
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url = templateDir + "newsRead.php";
	url = url+"?sid=" + Math.random();
	url = url+"&langID=" + fnLangID;
	url = url+"&newsID=" + newsID;

	window.location.href = url;
	
//	xmlHttp001.onreadystatechange = stateChanged001a;
//	xmlHttp001.open("GET", url, true);
//	xmlHttp001.send(null);
}

function viewHomeSite(fnLangID,numTotEl){
	/*
	xmlHttp001=GetXmlHttpObject()
	if (xmlHttp001==null){
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url = templateDir + "mainDataDx.php";
	url = url+"?sid=" + Math.random();
	url = url+"&langID=" + fnLangID;
	xmlHttp001.onreadystatechange = stateChanged001a;
	xmlHttp001.open("GET", url, true);
	xmlHttp001.send(null);
	emptyMenu(numTotEl);
	*/
	emptyMenu(numTotEl);
	viewFixSite('',fnLangID,numTotEl,'0');
}

function viewFixSite(fixID,fnLangID,numTotEl,contaEl){
//	xmlHttp001=GetXmlHttpObject()
//	if (xmlHttp001==null){
//		alert ("Your browser does not support AJAX!");
//		return;
//	} 
	var url = templateDir + "fixSitePage.php";
	url = url+"?sid=" + Math.random();
	url = url+"&langID=" + fnLangID;
	url = url+"&fixID=" + fixID;
//	xmlHttp001.onreadystatechange = stateChanged001a;
//	xmlHttp001.open("GET", url, true);
//	xmlHttp001.send(null);
//	if(contaEl>0){
//		document.getElementById("numElMenu").value = contaEl;
//	}
//	buildMenu(contaEl,numTotEl);
	window.location.href = url;
}


function viewCat(catID,fnLangID,numTotEl,contaEl){
//	xmlHttp001=GetXmlHttpObject()
//	if (xmlHttp001==null){
//		alert ("Your browser does not support AJAX!");
//		return;
//	} 
	var url = templateDir + "catPage.php";
	url = url+"?sid=" + Math.random();
	url = url+"&langID=" + fnLangID;
	url = url+"&catID=" + catID;
//	xmlHttp001.onreadystatechange = stateChanged001b;
//	xmlHttp001.open("GET", url, true);
//	xmlHttp001.send(null);
//	if(contaEl>0){
//		document.getElementById("numElMenu").value = contaEl;
//	}
	//buildMenu(contaEl,numTotEl);
	window.location.href = url;
}

function viewCatPage(tipoID,catID,fnLangID){
	xmlHttp001=GetXmlHttpObject()
	if (xmlHttp001==null){
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url = templateDir + "catPage02.php";
	url = url+"?sid=" + Math.random();
	url = url+"&langID=" + fnLangID;
	url = url+"&catID=" + catID;
	url = url+"&tipoID=" + tipoID;

	window.location.href = url;

//	xmlHttp001.onreadystatechange = stateChanged001a;
//	xmlHttp001.open("GET", url, true);
//	xmlHttp001.send(null);
}

function viewProduct(prodID,fnLangID){
	xmlHttp001=GetXmlHttpObject()
	if (xmlHttp001==null){
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url = templateDir + "viewProduct.php";
	url = url+"?sid=" + Math.random();
	url = url+"&langID=" + fnLangID;
	url = url+"&prodID=" + prodID;
	
	window.location.href = url;
	
//	xmlHttp001.onreadystatechange = stateChanged001a;
//	xmlHttp001.open("GET", url, true);
//	xmlHttp001.send(null);
}

function viewNews(prodID,fnLangID){
	xmlHttp001=GetXmlHttpObject()
	if (xmlHttp001==null){
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url = templateDir + "viewNews.php";
	url = url+"?sid=" + Math.random();
	url = url+"&langID=" + fnLangID;
	url = url+"&prodID=" + prodID;
	
	window.location.href = url;
	
//	xmlHttp001.onreadystatechange = stateChanged001a;
//	xmlHttp001.open("GET", url, true);
//	xmlHttp001.send(null);
}

function emptyMenu(numTotEl){
	/*
	for(fnX=0;fnX<numTotEl;fnX++){
		document.getElementById("fixSite"+fnX).style.backgroundImage = "url(" + templateDir + "img/btn01.gif)";
		document.getElementById("fixSite"+fnX).style.color = "#FFFFFF";
		document.getElementById("fixSite"+fnX).style.top = "0px";
	}
	*/
}

function buildMenu(contaEl,numTotEl){
	/*
	emptyMenu(numTotEl);
	if(contaEl==-1){
		contaEl = document.getElementById("numElMenu").value;
	}
	document.getElementById("fixSite"+contaEl).style.backgroundImage = "url(" + templateDir + "img/btn02.jpg)";
	document.getElementById("fixSite"+contaEl).style.color = "#FFFFFF";
	document.getElementById("fixSite"+contaEl).style.top = "-1px";
	*/
}

function showSubMenu(){
	document.getElementById("subMenuId").style.visibility = "visible";
	//document.getElementById("subMenuId01").style.background = "#8B8C8E";
	document.getElementById("subMenuId01").style.backgroundImage = "url('./img/barMiddleLeftOn.jpg')";
	document.getElementById("subMenuId01").style.backgroundRepeat = "repeat-x";
	document.getElementById("subMenuId01").style.backgroundPosition = "center bottom";
}

function hideSubMenu(){
	document.getElementById("subMenuId").style.visibility = "hidden";
	//document.getElementById("subMenuId01").style.background = "";
	document.getElementById("subMenuId01").style.backgroundImage = "url('./img/barMiddleLeft.jpg')";
	document.getElementById("subMenuId01").style.backgroundRepeat = "repeat-x";
	document.getElementById("subMenuId01").style.backgroundPosition = "center bottom";
}

function hiddenDiv(){
	document.getElementById("divVideo").style.visibility = "hidden";
}

function opacity(id, opacStart, opacEnd, millisec, styleVis) {
    var speed = Math.round(millisec / 100);
    var timer = 0;
	var object = document.getElementById(id).style;

    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
		setTimeout("hiddenDiv()", 210);
    } else if(opacStart < opacEnd) {
		object.visibility = styleVis;
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
} 

function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}

function zeroOpac(id) {
    var object = document.getElementById(id).style;
    object.opacity = 0;
    object.MozOpacity = 0;
    object.KhtmlOpacity = 0;
    object.filter = "alpha(opacity=0)";
}

function showHomePopup(){
	divW = 900; //971
	aw = screen.availWidth;
	aw = (aw / 2) - (divW / 2);
	divH = 600; //665
	ah = screen.availHeight;
	ah = (ah / 2) - (divH / 2);
	if(ah>120){ah -= 100;}
	if(screen.availWidth>1025){
		document.getElementById("divVideo01").style.top = ah+"px";
		document.getElementById("divVideo01").style.left = aw+"px";
	} else {
		document.getElementById("divVideo01").style.top = "28px";
		document.getElementById("divVideo01").style.left = "42px";
	}
	aw -= 42;
	ah -= 28;
	if(screen.availWidth>1025){
		document.getElementById("divVideo00").style.top = ah+"px";
		document.getElementById("divVideo00").style.left = aw+"px";
	} else {
		document.getElementById("divVideo00").style.top = "0px";
		document.getElementById("divVideo00").style.left = "0px";
	}
	opacity('divVideo', 0, 25, 200, 'visible');
	setTimeout("document.getElementById('divVideo00').style.visibility = 'visible';", 210);
	setTimeout("document.getElementById('divVideo01').style.visibility = 'visible';", 215);
	playVideo("10050");
}

function hideHomePopup(){
	document.getElementById("divVideo00").style.visibility = "hidden";
	document.getElementById("divVideo01").style.visibility = "hidden";
	document.getElementById("playDiv").innerHTML = "";
	opacity('divVideo', 25, 0, 200, 'hidden');
}

function playVideo(fnVideoID){
	document.getElementById("playDiv").innerHTML = "";
	switch(fnVideoID){
		case "10050":
			fnString = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='520' height='350' title=''><param name='movie' value='./Video_10050.swf' /><param name='quality' value='high' /><embed style=' border:1px solid #000000;' src='./Video_10050.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='520' height='350'></embed></object>";
			break;
		case "10051":
			fnString = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='520' height='350' title=''><param name='movie' value='./Video_10051.swf' /><param name='quality' value='high' /><embed style=' border:1px solid #000000;' src='./Video_10051.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='520' height='350'></embed></object>";
			break;
		case "10052":
			fnString = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='520' height='350' title=''><param name='movie' value='./Video_10052.swf' /><param name='quality' value='high' /><embed style=' border:1px solid #000000;' src='./Video_10052.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='520' height='350'></embed></object>";
			break;
	}
	document.getElementById("playDiv").innerHTML = fnString;
}
