function MM_swapImgRestore() { //v3.0
  		var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}

	function MM_preloadImages() { //v3.0
		var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}

	function MM_findObj(n, d) { //v4.01
		 var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    	 d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  		if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  		for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  		if(!x && d.getElementById) x=d.getElementById(n); return x;
	}
	function resetMenu(){
		//modify by Chatchai L. INC465947
		//Modified by Wittawat I. Case 508898
		document.menu01.src='image/home/Page01_09.gif';
		document.menu02.src='image/home/Page01_10.gif';
		document.menu03.src='image/home/Page01_11.gif';
		document.menu04.src='image/home/Page01_12.gif';
		document.menu05.src='image/home/Page01_13.gif';
	}
	function MM_swapImage() { //v3.0
		var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   		if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}
	
	//Edited by Wittawat I. 25/03/2009
	//PBI000000000066
	//CSM e-Ordering Login
	function openLoginWindow(url){ 
		
		iwidth = 600;
		iheight = 300;
		aHeight = screen.availHeight;
		aWidth 	= screen.availWidth;
		aTop 	= aHeight/2 - iheight/2;
		aLeft	= aWidth/2  - iwidth/2;
		spec	= 'left='+aLeft+',top='+aTop+',width=500,height=350,menubar=no,status,scrollbars,resizable';	
		window.name = "MAIN";
		window.open(url ,'',spec);
				
	}
	/*function openLoginWindow(){
		if(isIntranetAccess()){
			openInWindow(600,300);		
		}else{
			openExWindow(600,300);
		}
	}
	function openExWindow(iwidth,iheight) {			
		aHeight = window.screen.availHeight;
		aWidth 	= window.screen.availWidth;
		aTop 	= aHeight/2 - iheight/2;
		aLeft	= aWidth/2  - iwidth/2;
		spec	= 'left='+aLeft+',top='+aTop+',width=500,height=350,menubar=no,status,scrollbars,resizable';				
		window.name = "MAIN";
	 	window.open('/cs/csLoginExt.jsp' ,'',spec);
	}
	function openInWindow(iwidth,iheight) {
		aHeight = screen.availHeight;
		aWidth 	= screen.availWidth;
		aTop 	= aHeight/2 - iheight/2;
		aLeft	= aWidth/2  - iwidth/2;
		spec	= 'left='+aLeft+',top='+aTop+',width=500,height=350,menubar=no,status,scrollbars,resizable';	
		window.name = "MAIN";
		window.open('/cs/csLoginInt.jsp' ,'',spec);
	}
	function isIntranetAccess(){
		
		//For Test Server 
		//if(location.hostname.indexOf("testintra")){
		//	return false;
		//}
		
		//For Production Server
		//if(location.hostname.indexOf("intra")){
		//	return false;
		//}
		
		return true; 
	}*/
	
	//Added By Wittawat I. Case : 364547 Link Home Express (SD) 20/05/2008
	/*function openWindow(url) {    
		var options = 'scrollbars=yes,resizable=yes,status=yes,toolbar=yes,menubar=yes,location=yes';    
			options += ',width=' + screen.availWidth + ',height=' + screen.availHeight;    
			options += ',screenX=0,screenY=0,top=0,left=0';    
		var win = window.open(url, '', options);    
			win.focus();    
			win.moveTo(0, 0);
			win.resizeTo(screen.availWidth, screen.availHeight);
	}
	
	function openSDExWindow(iwidth,iheight) {			
		aHeight = window.screen.availHeight;
		aWidth 	= window.screen.availWidth;
		aTop 	= aHeight/2 - iheight/2;
		aLeft	= aWidth/2  - iwidth/2;
		window.name = "MAIN";
		openWindow('/sd/jsp/login.jsp')	;
	}
	function openSDInWindow(iwidth,iheight) {
		aHeight = window.screen.availHeight;
		aWidth 	= window.screen.availWidth;
		aTop 	= aHeight/2 - iheight/2;
		aLeft	= aWidth/2  - iwidth/2;
		window.name = "MAIN";
		openWindow('/sd/jsp/login.jsp')	;
	}	
	//Added By Wittawat I. Case : 364547 Link Home Express (SD) 20/05/2008
	function openSDLoginWindow(){
		if(isIntranetAccess()){
			openSDInWindow(1000,700);		
		}else{
			openSDExWindow(1000,700);
		}
	}*/
	
	//Edited by Wittawat I. 25/03/2009
	//PBI000000000066
	//CSM Portal Login
	function gotoPortal(url)
	{
		/* 	http://mypartner.cementhaionline.com 	for Production
			http://csmwebq1.cementhai.co.th/irj 	for Test
		*/
		//Edited by Wittawat I. Case 511526
		//window.open(url); 
		window.location = url;
	}
	/*function isProductionAccess() {
		if (location.hostname.indexOf("test") != -1) {
			return false;
		}
		return true;	
	}
	function gotoPortal()
	{
		if (isProductionAccess())
		{
			//window.document.location.href = "http://mypartner.cementhaionline.com/irj";
			window.open('http://mypartner.cementhaionline.com');
		} else {
			//window.document.location.href = "http://csmwebq1.cementhai.co.th/irj";
			window.open('http://csmwebq1.cementhai.co.th/irj');
		}	
	}*/
	
	//Edited by Wittawat I. 25/03/2009
	//PBI000000000066
	//CSM Dealer Login
	function gotoCsmDealer(url)
	{	/* 	http://mypartner.cementhaionline.com/icssb2b_user	for Production
			http://csmwebq1.cementhai.co.th/icssb2b_user		for Test
		*/
		//Edited by Wittawat I. Case 511526
		//window.open(url);
		window.location = url;
	}
	/*function gotoCsmDealer()
	{
		if (isProductionAccess())
		{
			//window.document.location.href = "http://mypartner.cementhaionline.com/icssb2b_user";
			window.open('http://mypartner.cementhaionline.com/icssb2b_user');
		} else {
			//window.document.location.href = "http://csmwebq1.cementhai.co.th/icssb2b_user";
			window.open('http://csmwebq1.cementhai.co.th/icssb2b_user');
		}	
	}*/
	
	//Edited by Wittawat I. 25/03/2009
	//PBI000000000066
	//CSM e-Payment
	function gotoePayment(url)
	{
		window.open(url);
	}
	/*function gotoePayment()
	{
		window.open('image/home/epayment.htm');
	}*/

	function hideAll()
	{
		document.getElementById("div_1").style.display="none"
		document.getElementById("div_2").style.display="none"
		document.getElementById("div_3").style.display="none"
		document.getElementById("div_4").style.display="none"
		document.getElementById("div_5").style.display="none"
	//	document.getElementById("div_6").style.display="none"     //modify by Chatchai L. INC465947
	}
	function showForm(div_id)
	{
	  	hideAll();
	  	document.getElementById(div_id).style.display="block";	
	}
	
	
	
	//Edited by Wittawat I. 25/03/2009
	//PBI000000000066
	//Cementhai Homemart
	function gotoHomemart(url){
		window.open(url);
	}
	
	/*function gotoProductcat()
	{
		//Edited by Wittawat I. Case 446120 13/03/2009
		window.open('http://www.homemart.co.th');
	}
	function gotoHomemart()
	{
		//Edited by Wittawat I. Case 446120 13/03/2009
		window.open('http://www.homemart.co.th');
	}
	function gotoBranchLocation()
	{
		//Edited by Wittawat I. Case 446120 13/03/2009
		window.open('http://www.homemart.co.th');
	}*/