// Suppress ALL error messages

function stopErrors() {
 return true;
}
window.onError = stopErrors();

// Global variables

var isNav4, isIE4;
var available_width;
var available_height;
var range = "";
var styleObj = "";

var MouseCnt = 0;
var logged = "";


// Check for Browser type

if (navigator.appVersion.charAt(0) == "4") {
	if (navigator.appName == "Netscape") {
		isNav4 = true
	} else {
		isIE4 = true
		range = "all."
		styleObj = ".style"
	}
}


//==================================================
//===
//=== FUNCTION:getObject - Convert an object name string or object
//===                      reference into a valid object reference
//===
//==================================================

function getObject(object) {
 var theObj;
 if (typeof object == "string") {
  theObj = eval("document." + range + object + styleObj);
 } else {
  theObj = object;
 }
 return (theObj);
}

//==================================================
//===
//=== FUNCTION:ShowLayer - Show a layer
//===
//==================================================

function ShowLayer(object) { 
 var theObj = getObject(object);
 theObj.visibility = "visible";
}

//==================================================
//===
//=== FUNCTION:HideLayer - Hide a Layer
//===
//==================================================

function HideLayer(object) { 
 var theObj = getObject(object);
 theObj.visibility = "hidden";
}

//==================================================
//===
//=== FUNCTION:GoTo - Place an object at the (X,Y) coordinates on the screen
//===
//==================================================

function GoTo(object,x,y) {
 var theObj = getObject(object);
 if (isNav4) {
  theObj.moveTo(x,y);
 } else {
  theObj.pixelLeft = x;
  theObj.pixelTop = y;
 }
}

//==================================================
//===
//=== FUNCTION:getObjectLeft - Retrieving the x coordinate of a positionable object
//===
//==================================================

function getObjectLeft(object)  {
	var theObj = getObject(object)
	if (isNav4) {
		return theObj.left
	} else {
		return theObj.pixelLeft
	}
}

//==================================================
//===
//=== FUNCTION:getObjectTop - Retrieving the y coordinate of a positionable object
//===
//==================================================

function getObjectTop(object)  {
	var theObj = getObject(object)
	if (isNav4) {
		return theObj.top
	} else {
		return theObj.pixelTop
	}
}

//==================================================
//===
//=== FUNCTION:SlideTo - Take a layer and slide it to the X,Y position indicated
//===
//==================================================

function SlideTo(name,x_end,y_end){
  
  // Get objects current X,Y coordinate
  x_curr = getObjectLeft(name);
  y_curr = getObjectTop(name);
  
  // If current X coordinate is off the screen then set it to to screens edge
  if (x_curr < 0) {x_curr = 0;}
  if (x_curr > available_width) {x_curr=available_width;}

  // If current Y coordinate is off the screen then set it to the screens edge
  if (y_curr < 0) {y_curr = 0;}
  if (y_curr > available_height) {y_curr=available_height;}

  // Get the difference between where the object is to where you want it to go
  x_diff = x_end - x_curr;
  y_diff = y_end - y_curr;
  
  // If you are more than one X unit away 
  // Then divide by 10 and round the result (this provides a decelaration effect)
  // Else set increment to 0
  if ( (x_diff < (-1) ) || (x_diff > (1) ) ) {
   x_inc=Math.round(x_diff/10);
  } else {
   x_inc = 0;
  }

  // If you are more than one Y unit away 
  // Then divide by 10 and round the result (this provides a decelaration effect)
  // Else set increment to 0
  if ( (y_diff < (-1) ) || (y_diff > (1) ) ) {
   y_inc=Math.round(y_diff/10);
  } else {
   y_inc = 0;
  }

  // Add increment to current X and Y coordinate to get the new one.
  x_new = x_curr + x_inc;
  y_new = y_curr + y_inc;

  // If you still need to increment in X or Y direction, then move there and
  // Call the function again 
  if (x_inc != 0 | y_inc !=0) {

   
   GoTo(name,x_new,y_new);

   command = 'SlideTo("' + name + '","' + x_end + '","' + y_end + '")';
   setTimeout(command,50);
  }
}

//==================================================
//===
//=== FUNCTION:Preload - Preload an image so it is in the browsers Cache
//===
//==================================================

function Preload(img){
 tmp = new Image();
 tmp.src = img;
}

//==================================================
//===
//=== FUNCTION:StickyNote
//===
//=== Keep a object stationary on the screen as
//=== you scroll down the screen.  Make it stay
//=== at sideleft, sidetop (relative to the top of
//=== the current display window
//==================================================

function StickyNote(object,sideleft,sidetop){

  movex=0;
  movey=0;
  
  // Get current objects location
  
  x_curr = getObjectLeft(object)
  y_curr = getObjectTop(object)
  
  // Get the location of the top of the current display
  
  if (isNav4) {
   Y_top=eval("window.pageYOffset");
   X_top=eval("window.pageXOffset");
  }
  if (isIE4) {
   Y_top=eval("document.body.scrollTop");
   X_top=eval("document.body.scrollLeft");
  }

  // Offset that location by sideleft and sidetop
  
  x_end = X_top + sideleft;
  y_end = Y_top + sidetop;
  
  // Get the distance between those points

  ydiff=y_end-y_curr;
  xdiff=x_end-x_curr
   
  // Calculate how far to move this time (dividing by 10 gives you a decelleration effect)

  if ( (ydiff < (-1) ) || (ydiff > (1) ) ) { movey=Math.round(ydiff/10);}
  if ( (xdiff < (-1) ) || (xdiff > (1) ) ) { movex=Math.round(xdiff/10);}

  // Get new position to move to and then go there

  new_x = x_curr + movex;
  new_y = y_curr + movey;
  
  GoTo(object,new_x,new_y);
  
  // Run this function again in 10/100th of a second
  
  command = 'StickyNote("' + object + '",' + sideleft + "," + sidetop + ')';
  setTimeout(command,10)

}

function StartPage () {

GoTo("sidemenu",3,0);
StickyNote("sidemenu",3,0);

}

function OpenHuman () {
 win=open("http://hc2.humanclick.com/hc/69440848/?cmd=file&file=visitorWantsToChat&site=69440848&d=976766818140","HumanClick","width=500,height=320");
}


function MouseLink(URL,off,on) {
 //////////////
 // The MouseLink Function creates a link to a URL using 2 graphics images.
 // One image is used for when the mouse passes over the link (on) and the other
 // for when the mouse is off the link. The Images are "preloaded" to make the
 // mouseovers fast.  Just place the function call where ever you want the link
 // to appear in your HTML
 //////////////
 
  // Count how many time this is called
  MouseCnt++;
  
  // Preload images in Web browers Cache
  Preload(on);
  Preload(off);
   
  // Build <a> and <img> HTML tags for mousing over the images
  htmlstuff =             "<a href='" + URL + "'";
  htmlstuff = htmlstuff + " onmouseover='ML" + MouseCnt + ".src=\"/SwitchEmail/Images/" + on + "\"'";
  htmlstuff = htmlstuff + " onmouseout='ML" + MouseCnt + ".src=\"/SwitchEmail/Images/" +  off + "\"'>";
  htmlstuff = htmlstuff + "<img name=ML" + MouseCnt;
  htmlstuff = htmlstuff + " border=0";
  htmlstuff = htmlstuff + " src=/SwitchEmail/Images/" + off + ">";
  htmlstuff = htmlstuff + "</a>";

  // return HTML tags to calling function
  return(htmlstuff);

 }

//==================================================
//===
//=== FUNCTION:Header
//===
//=== Use document.write to write out the html
//=== needed for the top title and side menu.
//==================================================

function Header(){

document.writeln(" <table width=750 border=0 cellpadding=0 cellspacing=0>");
document.writeln(" <tr>");
document.writeln("  <td WIDTH=140>&nbsp;</td>");
document.writeln("  <td align=left valign=top>");
document.writeln("   <img src='/SwitchEmail/Images/OldtoNewLogo.gif' width=600 height=35 border=0 align=left alt='SwitchEmail.Com - Free Link from OLD to NEW Email'>");
document.writeln("  </td>");
document.writeln(" </tr>");
document.writeln(" <tr>");
document.writeln("  <td WIDTH=140>&nbsp;</td>");
document.writeln("  <td align=left height=500 valign=top>");
document.writeln("   <img src='/SwitchEmail/Images/UL.gif' width=243 height=193 border=0>");
document.writeln("  </td>");
document.writeln(" </tr>");
document.writeln("</table>");

document.writeln("<DIV id=sidemenu style='position:absolute;visibility:visible;Top:1px;Left:-500px;Z-Index:10'>");
document.write("   <table width=140 border=1 bordercolor=white cellpadding=0 cellspacing=0>");
document.write("    <tr><td colspan=2 align=center><img src='/SwitchEmail/Images/HandLogo-BWtoColor.gif' width=122 height=75 border=0 alt='Switch from OLD to New Email'></td></tr>");
document.write("    <tr><td colspan=2 align=center>"+MouseLink('/SwitchEmail/Pages/index.asp?bypass=true','ButHomeOFF.gif','ButHomeON.gif')+"</td></tr>");
document.write("    <tr><td colspan=2 align=center>"+MouseLink('/SwitchEmail/Pages/login.asp','ButRegLogOFF.gif','ButRegLogON.gif')+"</td></tr>");
document.write("    <tr><td colspan=2 align=center>"+MouseLink('/SwitchEmail/Pages/personSearch.asp','ButLookUpOFF.gif','ButLookUpON.gif')+"</td></tr>");
document.write("    <tr><td colspan=2 align=center>"+MouseLink('/SwitchEmail/Pages/down.asp','ButDownloadOFF.gif','ButDownloadON.gif')+"</td></tr>");
document.write("    <tr><td colspan=2 align=center>"+MouseLink('/SwitchEmail/Pages/lostandfound.asp','ButLostOFF.gif','ButLostON.gif')+"</td></tr>");
document.write("    <tr><td colspan=2 align=center>"+MouseLink('/SwitchEmail/Pages/undeliver.asp','ButUndeliverablesOFF.gif','ButUndeliverablesON.gif')+"</td></tr>");
document.write("    <tr><td colspan=2 align=center>"+MouseLink('/SwitchEmail/Pages/faqs.asp','ButFAQSOFF.gif','ButFAQSON.gif')+"</td></tr>");
document.write("    <tr><td colspan=2 align=center>"+MouseLink('/SwitchEmail/Pages/contacts.asp','ButHelpOFF.gif','ButHelpON.gif')+"</td></tr>");
document.write("    <tr><td colspan=2 align=center>"+MouseLink('/SwitchEmail/Pages/messageboard.asp','ButNoticeOFF.gif','ButNoticeON.gif')+"</td></tr>");
document.write("    <tr><td colspan=2 align=center>"+MouseLink('javascript:OpenHuman();','ButTalkOFF.gif','ButTalkON.gif')+"</td></tr>");
//document.write("    <tr><td colspan=2 align=center>"+MouseLink('/SwitchEmail/Pages/CompareISPs.asp','ButSponsorsOFF.gif','ButSponsorsON.gif')+"</td></tr>");
document.write("    <tr><td colspan=2 align=center>"+MouseLink('/SwitchEmail/Pages/CompareISPs.asp','btnCompareISPs_off.gif','btnCompareISPs_on.gif')+"</td></tr>");
document.write("    <tr><td colspan=2 align=center>"+MouseLink('/SwitchEmail/Pages/affiliateprogram.asp','ButAffilliateOFF.gif','ButAffilliateON.gif')+"</td></tr>");
document.write("    <tr><td colspan=2 align=center>"+MouseLink('/SwitchEmail/Pages/InvestorRelations.asp','ButInvestorOFF.gif','ButInvestorON.gif')+"</td></tr>");

if (logged != "") {
document.write("    <tr><td colspan=2 align=right>"+MouseLink('/SwitchEmail/Pages/loginActivity.asp','ButAccountActivityOFF.gif','ButAccountActivityON.gif')+"</td></tr>");
document.write("    <tr><td colspan=2 align=right>"+MouseLink('/SwitchEmail/Pages/loginUser.asp','ButUserInformationOFF.gif','ButUserInformationON.gif')+"</td></tr>");
document.write("    <tr><td colspan=2 align=right>"+MouseLink('/SwitchEmail/Pages/loginEmails.asp','ButEmailInformationOFF.gif','ButEmailInformationON.gif')+"</td></tr>");
document.write("    <tr><td colspan=2 align=right>"+MouseLink('/SwitchEmail/Pages/changePassword.asp','ButChangePasswordOFF.gif','ButChangePasswordON.gif')+"</td></tr>");
document.write("    <tr><td colspan=2 align=right>"+MouseLink('/SwitchEmail/Pages/loginFriends.asp','ButFamilyFriendsOFF.gif','ButFamilyFriendsON.gif')+"</td></tr>");
document.write("    <tr><td colspan=2 align=right>"+MouseLink('/SwitchEmail/Pages/loginVip.asp','ButVipOFF.gif','ButVipON.gif')+"</td></tr>");
document.write("    <tr><td colspan=2 align=right>"+MouseLink('/SwitchEmail/Pages/loggedout.asp','ButLogoutOFF.gif','ButLogoutON.gif')+"</td></tr>");
}

document.write("   </table>");
//document.write("</div>");
}


//==================================================
//===
//=== FUNCTION:RegHeader
//===
//=== Use document.write to write out the html
//=== needed for the top title for the Registration pages
//==================================================

function RegHeader(){

document.writeln(" <table width=750 border=0 cellpadding=0 cellspacing=0>");
document.writeln(" <tr>");
document.writeln("  <td WIDTH=140>&nbsp;</td>");
document.writeln("  <td align=left valign=top>");
document.writeln("   <img src='/SwitchEmail/Images/OldtoNewLogo.gif' width=600 height=35 border=0 align=left alt='SwitchEmail.Com - Free Link from OLD to NEW Email'>");
document.writeln("  </td>");
document.writeln(" </tr>");
document.writeln(" <tr>");
document.writeln("  <td WIDTH=140>&nbsp;</td>");
document.writeln("  <td align=left height=500 valign=top>");
document.writeln("   <img src='/SwitchEmail/Images/UL.gif' width=243 height=193 border=0>");
document.writeln("  </td>");
document.writeln(" </tr>");
document.writeln("</table>");

document.writeln("<DIV id=sidemenu style='position:absolute;visibility:visible;Top:1px;Left:-500px;Z-Index:10'>");
document.write("   <table width=140 border=1 bordercolor=white cellpadding=0 cellspacing=0>");
document.write("    <tr><td colspan=2 align=center><img src='/SwitchEmail/Images/HandLogo-BWtoColor.gif' width=122 height=75 border=0 alt='Switch from OLD to New Email'></td></tr>");
document.write("   </table>");
document.write("</div>");

}

//==================================================
//===
//=== FUNCTION:footer
//===
//=== Use document.write to write out the html
//=== needed for the page footer
//==================================================

function Footer () {
 document.writeln(" <table width=750 border=0 cellpadding=0 cellspacing=0>");
 document.writeln(" <tr>");
 document.writeln("  <td valign=top>");
 document.writeln("   <img src='/SwitchEmail/Images/388176-purplefoncardaa.gif' width=468 height=60 border=0 align=left alt='Banner Ad'>");
 document.writeln("  </td>");
 document.writeln("  </tr>");
 document.writeln("  <tr>");
 document.writeln("  <td>");
 document.writeln("  <font size=1><br>All material herein © 2001 Vats Intercontinental Incorporated, all rights reserved.</font><br>");
 document.writeln("  <font size=1>SWITCHEMAIL.COM and SWITCHEMAIL are service marks of Vats Intercontinental Incorporated.</font>");
 document.writeln("  </td>");
 document.writeln(" </tr>");
 document.writeln("</table>");
}

