// JavaScript Document
//--- side menu start
var startList = function() {
if (document.all&&document.getElementById) {  
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
	   
	   if (node.nodeName=="LI") {
	     
	node.onmouseover=function() {
	this.className+=" topgreenover";
		for (j=0; j<this.childNodes.length; j++)
		{	
			divnode = this.childNodes[j];
			if (divnode.nodeName=="DIV") { 					
					divnode.className+=" greenover";
					this.className+=" over";				
			} 
		}
	  }
	  node.onmouseout=function() {
	  this.className=this.className.replace(" topgreenover", "");
	  for (j=0; j<this.childNodes.length; j++)
		{	
			divnode = this.childNodes[j];
			if (divnode.nodeName=="DIV") { 
				divnode.className=divnode.className.replace(" greenover", "");
				this.className=this.className.replace(" over", "");
			} 
		}	   	  
	   
	   }
   }
  }
  


  lnavRoot = document.getElementById("lnav");
for (i=0; i<lnavRoot.childNodes.length; i++) {
lnode = lnavRoot.childNodes[i];
if (lnode.nodeName=="LI") {
lnode.onmouseover=function() {
this.className+=" over";
  }
  lnode.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
  
  
  lnavRoot2 = document.getElementById("lnav2");
for (i=0; i<lnavRoot2.childNodes.length; i++) {
lnode2 = lnavRoot2.childNodes[i];
if (lnode.nodeName=="LI") {
lnode2.onmouseover=function() {
this.className+=" over";
  }
  lnode2.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
  
 }
}

ELO.functionsToCallOnload.push("startList()");

//----side menu end


var myimages=new Array()
function preloadimages(){
	for (i=0;i<preloadimages.arguments.length;i++){
		myimages[i]=new Image()
		myimages[i].src=preloadimages.arguments[i]
	}
}

//---------------------------------------

function validatenews()
{
		if(document.newsletter.email.value=='')
		{
			alert('Please enter the email address');
			return false;
		}
		if(document.newsletter.email.value!='')
		{
				if(!echeck(document.newsletter.email.value))				
						return false;
				
		}
		return true;
		
}



/**
 *  email validation script. )
 */

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
}


function swapimagesfirst(image1, image2,menulink)
{
	document.getElementById(image1).src='images/mid-green.jpg';
	document.getElementById(image2).src='images/mid-green-right.jpg';
	document.getElementById(menulink).style.backgroundImage='url(images/mid-green.jpg)';
}
function swapimagesbackfirst(image1, image2,menulink)
{
	document.getElementById(image1).src='images/mid-white.jpg';
	document.getElementById(image2).src='images/mid-sep.jpg';
	document.getElementById(menulink).style.backgroundImage='url(images/mid-white.jpg)';
}

function swapimages(image1, image2,menulink)
{
	document.getElementById(image1).src='images/mid-green-left.jpg';
	document.getElementById(image2).src='images/mid-green-right.jpg';
	document.getElementById(menulink).style.backgroundImage='url(images/mid-green.jpg)';
}

function swapimagesback(image1, image2,menulink)
{
	document.getElementById(image1).src='images/mid-sep.jpg';
	document.getElementById(image2).src='images/mid-sep.jpg';
	document.getElementById(menulink).style.backgroundImage='url(images/mid-white.jpg)';
}

function swapimageslast(image1, image2,menulink)
{
	document.getElementById(image1).src='images/mid-green-left.jpg';
	document.getElementById(image2).src='images/right-green.jpg';
	
	document.getElementById(menulink).style.backgroundImage='url(images/mid-green.jpg)';
}

function swapimagesbacklast(image1, image2,menulink)
{
	document.getElementById(image1).src='images/mid-sep.jpg';
	document.getElementById(image2).src='images/right-white.jpg';
	document.getElementById(menulink).style.backgroundImage='url(images/mid-white.jpg)';

}

