
var hideInterval =10;
var showInterval =10;
var movePixel=8;
var div_pos=-11;

var theWidth=0, theHeight=0;
var isInternetExplorer = false;

var treeView='';
var doAlerts=true;

function doShowMenw(){
	var obj_div_sliderMenu =  document.getElementById('div_sliderMenu');
		if (parseInt(obj_div_sliderMenu.style.left,10) >= -movePixel){
			//document.getElementById('toggleArrow').src='../../../images/lm_leftarrow.png';
			if (isInternetExplorer){toggleArrow.style.filter ="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../../../images/lm_leftarrow.png', sizingMethod='image');";}
			else{toggleArrow.style.background ="url(../../../images/lm_leftarrow.png)";}			
 		    clearInterval(showInterval);
			hideInterval=10;
			return;		 
		}
		obj_div_sliderMenu.style.left = (parseInt(obj_div_sliderMenu.style.left,10)+21) +"px";
		div_pos = parseInt(obj_div_sliderMenu.style.left,10);
	
	}
function dohideMenu(){
	var obj_div_sliderMenu =   document.getElementById('div_sliderMenu');
		if (parseInt(obj_div_sliderMenu.style.left,10)<= -(parseInt(obj_div_sliderMenu.style.width,10)-21)){
		 //document.getElementById('toggleArrow').src='../../../images/lm_rightarrow.png';
		if (isInternetExplorer){toggleArrow.style.filter ="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../../../images/lm_rightarrow.png', sizingMethod='image');";}
		else{toggleArrow.style.background ="url(../../../images/lm_rightarrow.png)";}			 
 		 clearInterval(hideInterval);
		 showInterval=10;
		 return;
		}
		obj_div_sliderMenu.style.left = (parseInt(obj_div_sliderMenu.style.left,10)-21) +"px";
		div_pos = parseInt(obj_div_sliderMenu.style.left,10);
	 }
   
   
   function hideMenu (){
   	var obj_div_sliderMenu =   document.getElementById('div_sliderMenu');
	if (div_pos < -movePixel)
	{
		showInterval = setInterval("doShowMenw()",showInterval);
	}
	else{
		hideInterval = setInterval("dohideMenu()",hideInterval);
	}	

   }

function setImages(val)
	{
	var top_ten_search_png = 'lm_top_ten_search.png';
	var about_your_crystal_ac_png = 'lg_about_your_crystal_ac.png' ;
	var product_and_services_png = 'lg_products_and_services.png' ;
	var how_to_apply_png = 'lg_how_to_applay.png' ;
	var about_icici_bank_png = 'lg_about_icici_bank.png' ;
	
	
	if(val==0) top_ten_search_png = 'lm_top_ten_search.png' ;
	if(val==1) about_your_crystal_ac_png = 'lg_about_your_crystal_ac_hover.png' ;
	if(val==2) product_and_services_png = 'lg_products_and_services_hover.png' ;
	if(val==3) how_to_apply_png = 'lg_how_to_applay_hover.png' ;
	if(val==4) about_icici_bank_png = 'lg_about_icici_bank_hover.png' ;
	

	if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) isInternetExplorer = true;
		
	if(isInternetExplorer) div_topTenSearch.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../../../images/"+top_ten_search_png+"', sizingMethod='image');"
	else  div_topTenSearch.style.background = "url(../../../images/"+top_ten_search_png+") no-repeat";
	
	if(isInternetExplorer) div_aboutYourCrystalAccount.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../../../images/"+about_your_crystal_ac_png+"', sizingMethod='image');"
	else  div_aboutYourCrystalAccount.style.background = "url(../../../images/"+about_your_crystal_ac_png+") no-repeat";
	
	if(isInternetExplorer) div_productsAndServices.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../../../images/"+product_and_services_png+"', sizingMethod='image');"
	else  div_productsAndServices.style.background = "url(../../../images/"+product_and_services_png+") no-repeat";
	
	if(isInternetExplorer) div_howToApply.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../../../images/"+how_to_apply_png+"', sizingMethod='image');"
	else  div_howToApply.style.background = "url(../../../images/"+how_to_apply_png+") no-repeat";
	
	if(isInternetExplorer) div_aboutIciciBank.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../../../images/"+about_icici_bank_png+"', sizingMethod='image');"
	else  div_aboutIciciBank.style.background = "url(../../../images/"+about_icici_bank_png+") no-repeat";	  
	  
	  }


function openSlider(){
	var obj_div_sliderMenu =  document.getElementById('div_sliderMenu');
	//document.getElementById('toggleArrow').src='../../../images/lm_leftarrow.png';
	if (isInternetExplorer){toggleArrow.style.filter ="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../../../images/lm_leftarrow.png', sizingMethod='image');";}
	else{toggleArrow.style.background ="url(../../../images/lm_leftarrow.png)";}		
	obj_div_sliderMenu.style.left = "-6px";
	div_pos=-6;
	hideInterval=10;
}
	  
function localLoadMenu(val){

	document.getElementById("frmContainer").src="";
	
	setImages(val);
	CZinit(val);
	openSlider();
}


function loadMenu(){

	//parent.frmContainer.location.href = "../../Contents/about_icici_bank/"+arr_pages[pageId];

	treeElem=window.opener.document.getElementById("treeId").value;
	
	setImages(treeElem);
	
	var obj_frm;
	if (parent.frmContainer==null){
		obj_frm=window.document;
	}
	else{
		obj_frm=parent.frmContainer.document;		
	}
		
		obj_frm.getElementById("StyleSheetID").value="1";
		obj_frm.onload=changeStyleSheets();		


//var obj = parent.document.getElementById("frmContainer").contentWindow;
//alert(obj.document.getElementById("StyleSheetID").value);

	loadSlider();
	CZinit(treeElem);
	doNext(treeElem)
}

function changeStyleSheets(){	
	
	var whichSheet; 
	var obj_win;
	var obj_frm;

//alert(parent.document);
	if (parent.document==null){
		obj_win=window.document;
	}
	else{
		obj_win=parent.document;
	}
		
//alert(parent.frmContainer);
	if (parent.frmContainer==null){
		whichSheet = window.document.getElementById("StyleSheetID").value;	
		obj_frm=window;
	}
	else{
		whichSheet = parent.frmContainer.document.getElementById("StyleSheetID").value;
		obj_frm=parent.frmContainer;
	}
	

	whichSheet=whichSheet-1;

	if(obj_win.styleSheets){
    var c = obj_win.styleSheets.length;
    //if (doAlerts) alert('Change to Style '+(whichSheet+1));
    for(var i=0;i<c;i++){
      if(i!=whichSheet){
        obj_frm.document.styleSheets[i].disabled=true;
      }else{
        obj_frm.document.styleSheets[i].disabled=false;
      }
    }
  }
}


	function doNext(treeElem){		

	if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) isInternetExplorer = true;	
	
	var obj_div_sliderMenu =   document.getElementById('div_sliderMenu');	
	var obj_div_scroll_container =   document.getElementById('div_scroll_container');	
	var obj_div_treeDiv1 =   document.getElementById('treeDiv1');	
	var obj_div_tree =   document.getElementById('treeDiv1');	
	var obj_div_logo =   document.getElementById('div_mainMenuContainer');

	obj_div_sliderMenu.style.left = -(parseInt(obj_div_sliderMenu.style.width,10)-21) +"px";
	var div_left_top= document.getElementById('div_left_top');
	var div_left_bottom= document.getElementById('div_left_bottom');
	var div_right_top= document.getElementById('div_right_top');
	var div_right_bottom= document.getElementById('div_right_bottom');
	if (isInternetExplorer){
		div_left_top.style.filter ="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../../../images/top_cor_l.png', sizingMethod='image')";
		div_left_bottom.style.filter ="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../../../images/bot_cor_l.png', sizingMethod='image');";
		div_right_top.style.filter ="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../../../images/top_cor_r.png', sizingMethod='image');";
		div_right_bottom.style.filter ="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../../../images/bot_cor_r.png', sizingMethod='image');";
		toggleArrow.style.filter ="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../../../images/lm_rightarrow.png', sizingMethod='image');";
		obj_div_sliderMenu.style.filter ="alpha(opacity=90)";
	}
	else{
		div_left_top.style.background ="url(../../../images/top_cor_l.png)";
		div_left_bottom.style.background  ="url(../../../images/bot_cor_l.png)";
		div_right_top.style.background ="url(../../../images/top_cor_r.png)";
		div_right_bottom.style.background ="url(../../../images/bot_cor_r.png)";
		toggleArrow.style.background ="url(../../../images/lm_rightarrow.png)";
		obj_div_sliderMenu.style.MozOpacity = 0.9;
		
		obj_div_sliderMenu.style.maxHeight= document.body.clientHeight - 58 +"px";
		obj_div_scroll_container.style.maxHeight= document.body.clientHeight - 158+"px";
		
	}	


	obj_div_sliderMenu.style.top = "130px";
	//var h = (typeof window.innerHeight != 'undefined' ? window.innerHeight : document.body.offsetHeight);
	//obj_div_sliderMenu.style.height= h+"px";

	obj_div_sliderMenu.style.display = "block";
	
//alert(	document.body.clientHeight +" "+window.height);
}
function CZinit(treeElem) {
	//alert(" global "+treeElem);
	
    myTree17 = new Bs_Tree();
	myTree17.loadSkin('winxp');
    myTree17.imageDir = "../../img/";
	myTree17.rememberState = false;
	myTree17.captionBgColor= "aqua";
  	
	for(var p=0;p< a.length;p++){
		a[p].isOpen=false;
	}
	
	//alert(this.id)
	a[treeElem].isOpen=true;
	
	myTree17.initByArray(a);
	myTree17.drawInto('treeDiv1');
	myTree17.applyState();
}

/*function include(script_filename) {
    document.write('<' + 'script');
    document.write(' language="javascript"');
    document.write(' type="text/javascript"');
    document.write(' src="' + script_filename + '">');
    document.write('</' + 'script' + '>');
}*/
  
   
 function windowWithoutToolbar(urlStr, width, height) {
     window.open(urlStr, '_blank', 'location=no,status=no,scrollbars=no,menubar=no,toolbar=no,directories=no,resizable=no,width=' + width + ',height=' + height)
   }
  
 function loadSlider(){
	 var	sliderDiv = document.createElement("div");
	 		sliderDiv.setAttribute("id","div_sliderMenu");
	 		sliderDiv.id="div_sliderMenu";			
			sliderDiv.style.position = "absolute"; 
			sliderDiv.style.left="-1px"; 
			sliderDiv.style.top="92px"; 
			sliderDiv.style.width="550px";  
			sliderDiv.style.display="none";

			sliderDiv.innerHTML = '<table cellpadding="0" cellspacing="0" border="0" width="100%" style="border:none;"><tr><td width="1%" style="padding:0px;"><div id="div_left_top" style="position:relative; top:0px; left:0px; width:22px; height:22px;"></div></td><td width="98%" style="background:url(../../../images/bk-tx.gif) bottom repeat-x; height:22px; padding:0px;"></td><td width="1%" style="padding:0px;"><div id="div_right_top" style="position:relative; top:0px; right:0px; width:22px; height:22px;"></div></td></tr><tr><td width="1%" background="../../../images/bk-lx.gif" style="padding:0px;"><img src="../../../images/bk-lx.gif" width="22" height="5"></td><td width="98%" style="background:url(../../../images/bluebg.gif); padding:10px"><div id="div_scroll_container"><div id="treeDiv1" style="width:100%"></div> <div id="toggleArrow" style="background:url(../../../images/bluebg.png);top:3px; right:2px; width:17px; height:17px; visibility:visible; cursor:pointer; position:absolute; z-index:10;" onclick="hideMenu();"></div> </td><td background="../../../images/bk-rx.gif" valign="middle" align="center" style="padding:0px;"><img src="../../../images/bk-rx.gif" width="22" height="5"></td></tr><tr><td width="1%" style="padding:0px;"><div id="div_left_bottom" style="position:relative; bottom:0px; left:0px; width:22px; height:22px;"></div></td><td width="98%" style="background:url(../../../images/bk-bx.gif) bottom repeat-x; height:22px; padding:0px;"></td><td width="1%" style="padding:0px;"><div id="div_right_bottom" style="position:relative; bottom:0px; right:0px; width:22px; height:22px; "></div></td></tr></table>';
	
			document.body.appendChild(sliderDiv);
	 }
	 


function NewContentPop(mypage, myname, w, h, scroll) 
{
	var today = new Date();
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	win = window.open(mypage, '_blank', winprops)
	if (parseInt(navigator.appVersion) >= 4) 
	{ 
		win.window.focus(); 
	}
}
