types = new Array;
types[0] = 'pic';
types[1] = 'pic';



banners = new Array;
banners[0] = '<a href="about.html" target="_self"><img src="images/banner3.jpg"  border="0" /></a>';
banners[1] = '<a href="about.html" target="_self"><img src="images/banner2.jpg"  border="0" /></a>';



flashs = new Array;
flashs[4] = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="629" height="371"><param name="movie" value="images/banner1.swf" /><param name="quality" value="high" /><param name="BGCOLOR" value="#000000" /><embed src="images/banner1.swf" width="629" height="371" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" bgcolor="#000000"></embed></object>';

texts = new Array;
texts[0] = '"A great place to learn and play!"';
texts[1] = '"A great place to learn and play!"';
texts[2] = '"A great place to learn and play!"';
texts[3] = '"A great place to learn and play!"';

var x = 0;
var current = 0;
var t;
function changeBanner() {
	
	if (x>=banners.length) x=0;
	
	if (types[x]=='flash')
	{
		document.getElementById('flash').style.visibility = 'visible';
		document.getElementById('flash').innerHTML = flashs[x];
	} else 
	{
		document.getElementById('flash').innerHTML ='';
		document.getElementById('flash').style.visibility = 'hidden';
	}
	
	document.getElementById('bannerPic').innerHTML = banners[x]; 
	//document.getElementById('bannerText').innerHTML = texts[x]; 
	if (current!=x){
	//document.getElementById('num'+x).className = 'current';
	//document.getElementById('num'+current).className = 'num';
	current=x;
	}
	x++;
	
	t=setTimeout("changeBanner();",6000);
}

function changeBannerByClick(i) {

	if (i!=null && i !=undefined) {
	clearTimeout(t);
	if (types[i]=='flash')
	{
		document.getElementById('flash').style.visibility = 'visible';
		document.getElementById('flash').innerHTML = flashs[i];
	}  else 
	{
		document.getElementById('flash').innerHTML ='';
		document.getElementById('flash').style.visibility = 'hidden';
	}
	
	document.getElementById('bannerPic').innerHTML = banners[i]; 
	//document.getElementById('bannerText').innerHTML = texts[i]; 
	
	if (current!=i){
	//document.getElementById('num'+i).className = 'current';
	//document.getElementById('num'+current).className = 'num';
	current=i;
	}
	
	x=i+1;
	
	t=setTimeout("changeBanner();",6000);
	}

}
function showCurrent(id){
	document.getElementById(id).className = 'menu3current';
}

function hideCurrent(id){
	document.getElementById(id).className = '';
}



function getWidth() {
  var myWidth = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
   
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
  
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
   
  }
  return myWidth;
}


function checklayer(){
		
		var d =document.getElementById('master');
		var l=0;
		var x=0
		if(navigator.appName == "Microsoft Internet Explorer")
			{l=497;x=1000}
		else
			{l=500;x=1000}
		//alert(getWidth());
		if(getWidth()<=x)
			d.style.left=0;
		else{
		var position_x=(getWidth()/2)-l;
		d.style.left=position_x+'px';
		}
	
	setTimeout("checklayer()",100);
}

function changePic(id){
	switch (id){
		case "1" : document.getElementById('partsPicPath').src="images/pvc_connector1.gif";
		          break;
		case "2" : document.getElementById('partsPicPath').src="images/pvc_connector2.gif";
		          break;
		case "3" : document.getElementById('partsPicPath').src="images/aluminium_plate.gif";
		          break;
		case "4" : document.getElementById('partsPicPath').src="images/aluminium_connector.gif";
		          break;
		default : document.getElementById('partsPicPath').src="images/pvc_connector1.gif";
	}
}
