var ns = (document.layers) ? 1:0;
var ie = (document.all) ? 1:0;
var browser=((ns || ie) && parseInt(navigator.appVersion)>=4)
var menunum = 7;


function init(){
	if(ns){
                        document.layers["submenuid1"].top=0;
			document.layers["submenuid2"].top=0;
			document.layers["submenuid3"].top=161;
			document.layers["submenuid4"].top=177;
			document.layers["submenuid5"].top=208;
			document.layers["submenuid6"].top=180;
			document.layers["submenuid7"].top=0;
			
		}
		
	
	else{
                        
		        document.all("submenuid1").style.top=0;
			document.all("submenuid2").style.top=100;
			document.all("submenuid3").style.top=161;
			document.all("submenuid4").style.top=177;
			document.all("submenuid5").style.top=208;
			document.all("submenuid6").style.top=180;
			document.all("submenuid7").style.top=0;
			
		}
	
}


function showit(LayerName){
	LayerName++;
	LayerName = LayerName='submenuid'+String(LayerName);
	if (ns){
		document.layers[LayerName].visibility="visible";
	}
	else{
		document.all(LayerName).style.visibility="visible";
	}
}

function hideall(){
	for(i=1; i<=menunum; i++){
		j=String(i);
		LayerName='submenuid'+j;
		if (ns){
			document.layers[LayerName].visibility="hidden";
		}
		else{
			document.all(LayerName).style.visibility="hidden";
		}
	}
}


var img_array = new Array(
        "main",
        "about",
	"software",
	"hardware",
	"news",
	"custs",
	"custl");




var add_array = new Array(
        "main.html", 
	"profile_c.html",
	"http://www.yahoo.com",
	"http://www.yahoo.com",
	"http://www.yahoo.com",
	"custs_c.html",
	"login.html");
	
function ImgOver(value) {
    eval(' document.images[value].src = ' + value +  '_over.src') ;
}
function ImgOn(value) {
    eval(' document.images[value].src = ' + value + '_on.src') ;
}
function ImgOff(value) {
    eval(' document.images[value].src = ' + value + '_off.src') ;
}
function createmenu(){
	document.writeln('<table cellspacing="0" cellpadding="0" border="0">');
	for(i=0; i<img_array.length; i++){
		                if (i==0) {
                                document.writeln('<tr><td bgcolor="#F0ECD0"><a href="coming_soon.html" onmouseover=hideall();><img src="images/menu_e.gif" border="0"></a></td></tr>'); 
                                }
                                if (i==1)
                                document.writeln('<tr><td bgcolor="#F0ECD0"><a onmouseover=hideall();><img src="images/cmenu_profile.gif"></a></td></tr>'); 
                                if (i==2) 
                                document.writeln('<tr><td bgcolor="#F0ECD0"><a onmouseover=hideall();><img src="images/cmenu_product.gif"></a></td></tr>'); 
                                if (i==4) 
                                document.writeln('<tr><td bgcolor="#F0ECD0"><a onmouseover=hideall();><img src="images/cmenu_other.gif"></a></td></tr>'); 

               if (add_array[i].indexOf("http") >=0) {
                               
                               
                                  
				document.writeln('<tr><td><a  target="_blank" onmouseover="ImgOver(\'' + img_array[i] + '\'); hideall(); showit(\'' + i + '\');" onmouseout="ImgOff(\'' + img_array[i] + '\');"><img src="'+ 'images/cmenu_' + img_array[i] + '_off.gif" border="0" name="' + img_array[i] + '"></a></td></tr>');
                                
			}else{
                               
			                                       
				document.writeln('<tr><td><a href="'+ add_array[i] + '"" onmouseover="ImgOver(\'' + img_array[i] + '\'); hideall(); showit(\'' + i + '\');" onmouseout="ImgOff(\'' + img_array[i] + '\');"><img src="'+ 'images/cmenu_' + img_array[i] + '_off.gif" border="0" name="' + img_array[i] + '"></a></td></tr>');
                                
			     }
    
	}
       
	document.writeln('<tr><td><img src="'+ 'images/trans.gif" height="2" width="1"></td></tr>');
	document.writeln('</table>');
}


function checkdata(value1,value2)
{
var user=0;
var pwd=0;

	for (i=0;i<=value1.length-1;i++)
	{
		user+=toAscii(value1.charAt(i));
	}
        
        for (i=0;i<=value2.length-1;i++)
	{
		pwd+=toAscii(value2.charAt(i));
	}
        
	if ( ((user==314) || (user==222) || (user==224) || (user==237)) && (pwd == 150))
	{
		var now = new Date()
		fixDate(now)
		now.setTime(now.getTime() + 31 * 24 * 60 * 60 * 1000)
		var name = getCookie("name")
		name = "true"
		setCookie("name", name, now)

  		if (user==314){
                	window.location.href="download.html";
		}
		else if(user==222)
		{
			window.location.href="download_bom.html";
		}
		else if(user==224)
		{
			window.location.href="download_acct.html";
		}	
		else
		{
			window.location.href="download_inv.html";
		}	
		return false
	}
	else
	{
            	window.location.href="err_login.html";
		return false
	}

}

function checklogin()
{
	var name = getCookie("name")
	
	if (!(name == "true"))
	{
 		window.location.href="login.html"; 
	}

	var now = new Date()
	fixDate(now)
	now.setTime(now.getTime() + 31 * 24 * 60 * 60 * 1000)
	name = "false";
	setCookie("name", name, now);
 
}


var caution = false

function setCookie(name, value, expires, path, domain, secure) 
{
	var curCookie = name + "=" + escape(value) +
	((expires) ? "; expires=" + expires.toGMTString() : "") +
	((path) ? "; path=" + path : "") +
	((domain) ? "; domain=" + domain : "") +
	((secure) ? "; secure" : "")
	if (!caution || (name + "=" + escape(value)).length <= 4000)
		document.cookie = curCookie
	else
	if (confirm("Cookie exceeds 4KB and will be cut!"))
		document.cookie = curCookie
}

function getCookie(name)
{
	var prefix = name + "="
	var cookieStartIndex = document.cookie.indexOf(prefix)
	if (cookieStartIndex == -1)
	return null

	var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)
	if (cookieEndIndex == -1)
	cookieEndIndex = document.cookie.length
	return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))
}

function deleteCookie(name, path, domain) {
	if (getCookie(name)) {
		document.cookie = name + "=" + 
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		"; expires=Thu, 01-Jan-70 00:00:01 GMT"
	}
}

function fixDate(date) {
	var base = new Date(0)
	var skew = base.getTime()
	if (skew > 0)
	date.setTime(date.getTime() - skew)
}



var symbols = " !\"#$%&'()*+'-./0123456789:;<=>?@";
function toAscii(value)  {
	var loAZ = "abcdefghijklmnopqrstuvwxyz";
	symbols+= loAZ.toUpperCase();
	symbols+= "[\\]^_`";
	symbols+= loAZ;
	symbols+= "{|}~";
	var loc;
	loc = symbols.indexOf(value);
	if (loc >-1) { 
		Ascii_Decimal = 32 + loc;
		return (32 + loc);
	}
	return(0);  // If not in range 32-126 return ZERO
}


function checkcookie()
{
	if (navigator.cookieEnabled == false)
	{
		
		window.location.href="err1_login.html";
        }		
	
}


product_m = new Image();
product_m.src = "images/cmenu_product.gif";


main_off = new Image();
main_off.src = "images/cmenu_main_off.gif";
main_over = new Image();
main_over.src = "images/cmenu_main_over.gif";

about_off = new Image();
about_off.src = "images/cmenu_about_off.gif";
about_over = new Image();
about_over.src = "images/cmenu_about_over.gif";


software_off = new Image();
software_off.src = "images/cmenu_software_off.gif";
software_over = new Image();
software_over.src = "images/cmenu_software_over.gif";


hardware_off = new Image();
hardware_off.src = "images/cmenu_hardware_off.gif";
hardware_over = new Image();
hardware_over.src = "images/cmenu_hardware_over.gif";


news_off = new Image();
news_off.src = "images/cmenu_news_off.gif";
news_over = new Image();
news_over.src = "images/cmenu_news_over.gif";


custs_off = new Image();
custs_off.src = "images/cmenu_custs_off.gif";
custs_over = new Image();
custs_over.src = "images/cmenu_custs_over.gif";



custl_off = new Image();
custl_off.src = "images/cmenu_custl_off.gif";
custl_over = new Image();
custl_over.src = "images/cmenu_custl_over.gif";


