/* HOMEPAGE SLIDESHOW START */

function reapply(){
setTimeout("slideit()",2000)
return true
}
window.onerror=reapply

var image1=new Image()
image1.src="slide_xpc.jpg"
var image2=new Image()
image2.src="slide_gamatronic.gif"
var image3=new Image()
image3.src="slide_toshiba.jpg"
var image4=new Image()
image4.src="slide_herytage.jpg"
var image5=new Image()
image5.src="slide_9170busway.jpg"
var image6=new Image()
image6.src="slide_f7.jpg"
var image7=new Image()
image7.src="slide_coolcube.jpg"
var image8=new Image()
image8.src="slide_power.jpg"
var image9=new Image()
image9.src="slide_ups.jpg"
var image10=new Image()
image10.src="slide_cdu.jpg"
//-->

////change number of images below 
var number_of_images=10
//change speed below (in seconds)
var speed=2
var step=1
var whichimage=1
function slideit(){
if (!document.images)
return
if (document.all)
slide.filters.blendTrans.apply()
document.images.slide.src=eval("image"+step+".src")
if (document.all)
slide.filters.blendTrans.play()
whichimage=step
if (step<number_of_images)
step++
else
step=1
if (document.all)
setTimeout("slideit()",speed*1000+3000)
else
setTimeout("slideit()",speed*1000)
}
function slidelink(){
if (whichimage==1)
window.location="xprt.htm"
else if (whichimage==2)
window.location="sa3.htm"
else if (whichimage==3)
window.location="tseries.htm"
else if (whichimage==4)
window.location="three_phase.htm"
else if (whichimage==5)
window.location="herytage.htm"
else if (whichimage==6)
window.location="power.htm"
else if (whichimage==7)
window.location="lineconditioners.htm"
else if (whichimage==8)
window.location="coolcube.htm"
else if (whichimage==9)
window.location="power.htm"
else if (whichimage==10)
window.location="ups.htm"
else if (whichimage==11)
window.location="slide_cdu.htm"
}

/* HOMEPAGE SLIDESHOW END */


function selectText(){
document.TheForm.TheText.focus();
document.TheForm.TheText.select();
}



/* OLD HOMEPAGE SLIDESHOW */
/* define image width and height */

var pic_width=200;
var pic_height=140;

/* define image urls */

if (document.images)
 {
     pic1= new Image(pic_width,pic_height);
     pic1.src="busway_9170_cab.jpg";  
     pic2= new Image(pic_width,pic_height); 
     pic2.src="9125-6K_lr.jpg"; 
     pic3= new Image(pic_width,pic_height);
     pic3.src="hand2.jpg";  
     pic4= new Image(pic_width,pic_height);
     pic4.src="coolcube2.jpg";  
     pic5= new Image(pic_width,pic_height);
     pic5.src="group.jpg";  
 }    

/* define text for image captions  */

var pics= new Array(5) 
   pics[0]=pic1.src;
   pics[1]=pic2.src;
   pics[2]=pic3.src;
   pics[3]=pic4.src;
   pics[4]=pic5.src;

var numpics=5;
var thenum=0;
imgName="img1";

function change_it()
 {
   if (document.images)
    {
      document.write("<IMG SRC='"+pics[thenum]+"' border='0' width='"+pic_width+"' height='"+pic_height+"' name='img1'>\n");
      setTimeout('change_it2()',5000);  
   }
}

function change_it2()
 {
         var x=0;
         thenum+=1;

           if (thenum>numpics-1)
             thenum=0;

           document[imgName].src=pics[thenum];
           x+=1;
           setTimeout('change_it2()',5000);
          
 }




var myimages=new Array()

function preloadimages(){
for (i=0;i<preloadimages.arguments.length;i++){
myimages[i]=new Image()
myimages[i].src=preloadimages.arguments[i]
}
}
//Enter path of images to be preloaded inside parenthesis. Extend list as desired.
preloadimages("bg.jpg")



function gotosite(site) {
  if (site != "") {
  self.location=site
  } 
}

function NewWindow(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable,toolbar=no'
win = window.open(mypage, myname, winprops)
/* if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); } */
}

function popup_null() {
}


function ValidateContact(theform) {
// Verify that required data exists prior
// to submitting review to server.

   	// MUST ENTER FIRST NAME
	if (theform.fname.value.length == 0) {
		alert( "Please enter First Name");
		theform.fname.focus();
		return false
	}

   	// MUST ENTER LAST NAME
	if (theform.lname.value.length == 0) {
		alert( "Please enter Last Name");
		theform.lname.focus();
		return false
	}

   	// MUST ENTER YOUR E-MAIL
	if (theform.email.value.length == 0) {
		alert( "Please enter E-mail Address");
		theform.email.focus();
		return false
	}

    // CHECK EMAIL FORMAT
    var input_str=theform.email.value;
    var input_len1=input_str.length;
    var iserror=0;
    input_len1=input_str.length;
    var lastdot=-1;
    var lastat=-1;
    var numberat=0;

    if (theform.email.value.length != 0) {

        for (var j = 0; j < input_len1; j++) {
             var ch2 = input_str.substring(j, j + 1);
             if (((ch2 < "a") ||  (ch2 > "z")) && ((ch2 < "A") || (ch2 > "Z")) && ((ch2 < "0") ||  (ch2 > "9")) && (ch2 != "@" ) && (ch2 != ".") && (ch2 != "_") && (ch2 != "-")){
                 alert("Please input a valid email address!\nValid characters include A-Z, a-z, 0-9, -, _, . and @");
                 iserror=1;
             }
             if (ch2==".") {
                 if ( j == lastdot + 1) {
                     alert("Please input a valid email address!\nYou can't have two dots next to\neach other'..'.");
                     iserror=1;
                 }
                 lastdot=j;
             }
             if (ch2=="@") {
                 lastat=j;
                 numberat=numberat+1
             }
             if (ch2==" ") {
                 alert("Please input a valid email address!\nYou can't have any spaces in the address.");
                 iserror=1;
             }
        }
        if (lastat == -1) {
             alert("Please input a valid email address!\nYou don't have an '@'.");
             iserror=1;
        }
        if (lastat == 0) {
             alert("Please input a valid email address!\nYou don't have a name before the '@'.");
             iserror=1;
        }
        if (numberat > 1) {
             alert("Please input a valid email address!\nYou may have only one '@'.");
             iserror=1;
        }
        if ((lastdot <= lastat) || (lastdot > input_len1 - 3 ) || (input_len1 - lastdot > 4)) {
             alert("Please input a valid email address!\nYou don't have a proper domain name!\nUse .com, .org, .net, .us, etc");
             iserror=1;
        }
        if (lastdot == lastat + 1) {
             alert("Please input a valid email address!\nYou don't have a proper organization name!\nUse name@organization.domain");
             iserror=1;
        }
        if (iserror==1) {
             theform.email.focus();
             return false;
        }

    }

    return true
}

