﻿// JavaScript Document
// JavaScript Document
//left_menu begin
var curr=null;
var hs=new Array();
var ps=new Array();
var pagePath;
var getHost = function(url) { 
        var host = "null";
        if(typeof url == "undefined"
                        || null == url)
                url = window.location.href;
        var regex = /.*\:\/\/([^\/]*).*/;
        var match = url.match(regex);
        if(typeof match != "undefined"
                        && null != match)
                host = match[1];
        return host;
}
function getPagePath()
{
         var   strHref   =   window.location.href; 
         strHref = strHref.slice(0,strHref.lastIndexOf( "/"));
         var   pagePath   =   strHref.slice(strHref.lastIndexOf( "/")+1);
         return pagePath;
}
function getElementsByClassName(clsName) 
{ 
	var arr = new Array(); 
	var elems = document.getElementsByTagName("*");
	for ( var cls, i = 0; ( elem = elems[i] ); i++ )
	{
		if ( elem.className == clsName )
		{
			arr[arr.length] = elem;
		}
	}
	return arr;
}
function initFaq(){
	hs=getElementsByClassName("D_title");
	ps=getElementsByClassName("D_content");
	for (var i=0;i<hs.length;i++){
		hs[i].id='a_syy_'+i;
		ps[i].id=hs[i].id+'_x';
                  pagePath = getPagePath();
		hs[i].onclick=function(){
			//if(this.id!='a_syy_0')
			//{document.getElementById("a_syy_0_x").style.display='none';}
			//if(curr == null){curr='a_syy_0';}
			if (curr!=null&&curr!=this.id){
			document.getElementById(curr+"_x").style.display='none';
			document.getElementById(this.id+"_x").style.display='block';		
				}
			var s=document.getElementById(this.id+"_x").style;
			//s.display=((s.display=='none')?'block':'none');
			if (s.display!='none'){
				curr=this.id;
			}
			else{
				curr=null;
			}
         }
		hs[i].style.cursor='pointer';
		if(i==0&&pagePath==getHost()){ps[i].style.display='block';curr='a_syy_0';}
		else if(i==0&&pagePath=="LaptopBattery"){ps[i].style.display='block';curr='a_syy_0';}
		else if(i==1&&pagePath=="LaptopAdapter"){ps[i].style.display='block';curr='a_syy_1';}
		else if(i==2&&pagePath=="PrinterBattery"){ps[i].style.display='block';curr='a_syy_2';}
		else if(i==3&&pagePath=="LaptopKeyboard"){ps[i].style.display='block';curr='a_syy_3';}
		else if(i==4&&pagePath=="LCDPanel"){ps[i].style.display='block';curr='a_syy_4';}
		else if(i==5&&pagePath=="LCDACAdapter"){ps[i].style.display='block';curr='a_syy_5';}
		else if(i==6&&pagePath=="UniversalPowerSupply"){ps[i].style.display='block';curr='a_syy_6';}
		else if(i==7&&pagePath=="PowerCordandCable"){ps[i].style.display='block';curr='a_syy_7';}
		else if(i==8&&pagePath=="FloppyDiskDrive"){ps[i].style.display='block';curr='a_syy_8';}
		else if(i==9&&pagePath=="LaptopCarCharger"){ps[i].style.display='block';curr='a_syy_9';}
		else if(i==10&&pagePath=="NetworkDevice"){ps[i].style.display='block';curr='a_syy_10';}
		else if(i==11&&pagePath=="HardDiskCase"){ps[i].style.display='block';curr='a_syy_11';}
		else if(i==12&&pagePath=="SlimOpticalDrive"){ps[i].style.display='block';curr='a_syy_12';}
		else{ ps[i].style.display='none';}
		}
                  if(curr == null){ps[0].style.display='block';curr='a_syy_0';}
}