// JavaScript Document

//Sliding menu script

var startY = 265;                 // start based on css
var destY  = startY;              // make start and des equal at page onload
var timerID;                      // timer for sample
var v1=0, v2=0;                   // two sampling points
var mpg_menu = "mpg_static_menu"; // div to use
var myWidth = 0, myHeight = 0;
var startX=0;
//== Initialise static menu when window loads runs other onload functions 
window.onload=function(){  
	
	if(!document.getElementById) {return;} // check for DOM give up browser to old!  
	initMenu();                        // add more functions as needed  
	screenopt1();
	//thick();
	window.onscroll = floatMenu;
	window.onresize = initMenu;
}
function initMenu(){  
var browser=navigator.appName;
var el = document.getElementById(mpg_menu);
var x=-3; 
 if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
if(browser=="Netscape"){startX=startX+x;}
else { x=0;}
if (myWidth>=0 && myWidth<=767) 	{	startX = 5;	}  
else if (myWidth>=767 && myWidth<=777) 	{	startX =x+10;}  
else if (myWidth>=778 && myWidth<=788) 	{	startX =x+15;}   
else if (myWidth>=789 && myWidth<=799) 	{	startX =x+20;}
else if (myWidth>=800 && myWidth<=810) 	{	startX =x+25;} 
else if (myWidth>=811 && myWidth<=820) 	{	startX =x+25;}  
else if (myWidth>=821 && myWidth<=830) 	{	startX =x+30;}   
else if (myWidth>=831 && myWidth<=840) 	{	startX =x+35;}
else if (myWidth>=841 && myWidth<=850) 	{	startX =x+40;} 
else if (myWidth>=851 && myWidth<=860) 	{	startX =x+45;}  
else if (myWidth>=861 && myWidth<=870) 	{	startX =x+50;}   
else if (myWidth>=871 && myWidth<=880) 	{	startX =x+55;}
else if (myWidth>=881 && myWidth<=890) 	{	startX =x+60;}    
else if (myWidth>=891 && myWidth<=900) 	{	startX =x+65;}  
else if (myWidth>=901 && myWidth<=910) 	{	startX =x+70;} 
else if (myWidth>=911 && myWidth<=920) 	{	startX =x+75;}  
else if (myWidth>=921 && myWidth<=930) 	{	startX =x+80;}   
else if (myWidth>=931 && myWidth<=940) 	{	startX =x+85;}
else if (myWidth>=941 && myWidth<=950) 	{	startX =x+90;} 
else if (myWidth>=951 && myWidth<=960) 	{	startX =x+95;}  
else if (myWidth>=961 && myWidth<=970) 	{	startX =x+100;}   
else if (myWidth>=971 && myWidth<=980) 	{	startX =x+105;}
else if (myWidth>=981 && myWidth<=990) 	{	startX =x+110;}    
else if (myWidth>=991 && myWidth<=1000) {	startX =x+115;}   
else if (myWidth>=1001 && myWidth<=1010) {	startX =x+120;}
else if (myWidth>=1011 && myWidth<=1020) {	startX =x+125;}
else if (myWidth>=1021 && myWidth<=1030) {	startX =x+130;}
else if (myWidth>=1031 && myWidth<=1040) {	startX =x+135;}
else if (myWidth>=10411 && myWidth<=1050) {	startX =x+140;}
else if (myWidth>=1051 && myWidth<=1060) {	startX =x+145;}
else if (myWidth>=1061 && myWidth<=1070) {	startX =x+150;}
else if (myWidth>=1071 && myWidth<=1080) {	startX =x+155;}
else if (myWidth>=1081 && myWidth<=1090) {	startX =x+160;}
else if (myWidth>=1091 && myWidth<=1100) {	startX =x+165;}
else if (myWidth>=1101 && myWidth<=1110) {	startX =x+170;} 
else if (myWidth>=1111 && myWidth<=1120) {	startX =x+175;} 
else if (myWidth>=1121 && myWidth<=1130) {	startX =x+180;}
else if (myWidth>=1131 && myWidth<=1140) {	startX =x+185;}
else if (myWidth>=1141 && myWidth<=1150) {	startX =x+190;}
else if (myWidth>=1151 && myWidth<=1160) {	startX =x+195;}
else if (myWidth>=1161 && myWidth<=1170) {	startX =x+200;} 
else if (myWidth>=1171 && myWidth<=1180) {	startX =x+205;}
else if (myWidth>=1181 && myWidth<=1190) {	startX =x+210;}
else if (myWidth>=1191 && myWidth<=1200) {	startX =x+215;}
else if (myWidth>=1191 && myWidth<=1200) {	startX =x+220;}
else if (myWidth>=1201 && myWidth<=1210) {	startX =x+225;}
else if (myWidth>=1211 && myWidth<=1220) {	startX =x+230;}  
else if (myWidth>=1221 && myWidth<=1230) {	startX =x+235;}
else if (myWidth>=1231 && myWidth<=1240) {	startX =x+240;}
else if (myWidth>=1231 && myWidth<=1240) {	startX =x+245;}
else if (myWidth>=1241 && myWidth<=1250) {	startX =x+250;}
else if (myWidth>=1251 && myWidth<=1260) {	startX =x+255;}
else if (myWidth>=1261 && myWidth<=1270) {	startX =x+260;}
else if (myWidth>=1271 && myWidth<=1280) {	startX =x+265;}
else if (myWidth>=1281 && myWidth<=1290) {	startX =x+270;}
else if (myWidth>=1291 && myWidth<=1300) {	startX =x+275;}
else if (myWidth>=1301 && myWidth<=1310) {	startX =x+280;}
else if (myWidth>=1311 && myWidth<=1320) {	startX =x+285;}
else if (myWidth>=1321 && myWidth<=1330) {	startX =x+290;}
else if (myWidth>=1331 && myWidth<=1340) {	startX =x+295;}
else if (myWidth>=1341 && myWidth<=1350) {	startX =x+300;}
else if (myWidth>=1351 && myWidth<=1360) {	startX =x+305;}
else if (myWidth>=1361 && myWidth<=1370) {	startX =x+310;}
else if (myWidth>=1371 && myWidth<=1380) {	startX =x+315;}
else if (myWidth>=1381 && myWidth<=1390) {	startX =x+320;}
else if (myWidth>=1391 && myWidth<=1395) {	startX =x+325;}
else if (myWidth>=1401 && myWidth<=1410) {	startX =x+330;}
else if (myWidth>=1411 && myWidth<=1420) {	startX =x+335;}
else if (myWidth>=1421 && myWidth<=1430) {	startX =x+340;}
else if (myWidth>=1431 && myWidth<=1440) {	startX =x+345;}
else if (myWidth>=1441 && myWidth<=1450) {	startX =x+350;}
else if (myWidth<=1600) 
	{
	startX = x+370;
	}
else
	{
	startX = x+0;
	}
	// get handle  .
	el.style.left = startX;                     // move to position  
	el.style.top  = startY;                     // move to position
} //end fun
function floatMenu(){                         // called by onscroll event  
	v1 = document.body.scrollTop;               // first sample  
	clearInterval(timerID);                     // reset tim for new sample
	timerID = setInterval("delay()", 150);      // time between samples
	} //end fun

function delay(){                             // delayed second sample
  v2=document.body.scrollTop;                 // get second sample
  if (v1==v2){                                 // user nolonger scrolling   
	 if(v2 > startY){                          // track us logo
		destY = v2 +10;                          // cal new position
		var el = document.getElementById(mpg_menu);  // get handle
		el.style.top = destY;                      // move to new pos
	 } 
	 else{
		destY = startY;                                                // cal new position
		var el = document.getElementById(mpg_menu);  // get handle
		el.style.top = destY;                                           // move to new pos
	  } 
   } //end if
} //end fun
function SelectedColor1(SColor, SerialNoColor)
{
    var SelColor;   
    var SNoColor;
    var len;
    var i;
    var CurSNo;
    var z;
    z=0;
	var x=0;
	x=document.getElementById("cpno").value;
	var txt=new Array();
	txt[1]="txt1";txt[2]="txt2";txt[3]="txt3";txt[4]="txt4";txt[5]="txt5";
	txt[6]="txt6";txt[7]="txt7";txt[8]="txt8";txt[9]="txt9";
        SelColor = document.getElementById(txt[x]).value;
        SNoColor = SerialNoColor;
        if((SelColor == "") || (SelColor == null))
        {
        SelColor = SColor;
        }
        else
        {
        SelColor = SelColor + "," + SColor;
        SNoColor = SNoColor + document.getElementById("temptext").value;
        }
        len = SNoColor.length;
        
        for(i=1; i<=len;i++)
        {
            CurSNo = SNoColor.substr(i,1);
            if(SerialNoColor == CurSNo)
            {
                alert("This color has already been selected.");
                z=1;
            }
        
        }
        
    
    if(z==0)
    {
    document.getElementById('temptext').value=SNoColor;
    document.getElementById(txt[x]).value = SelColor;
    }
}
function doClear(theText) 
{
     if (theText.value == theText.defaultValue)
 {
         theText.value = ""
     }
 }