var bugchars = '!#$^&*()+|}{[]?><~%:;/,=`"\'';
function CharsInBag(s)
{
	var i;
	var lchar="";
    for (i = 0; i < s.length; i++)
    {   
        var c = s.charAt(i);
		if(i>0)lchar=s.charAt(i-1)
        if (bugchars.indexOf(c) != -1 || (lchar=="." && c==".")) return false;
    }
    return true;
}
function isInteger(s)
{
	var i;
    for (i = 0; i < s.length; i++)
    {   
        var c = s.charAt(i);
        if ((c >= "0") && (c <= "9") && (c != ".")) return false;
    }
    return true;
}
function echeck(str) {
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		var lastdot=str.lastIndexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid email address. Please enter a valid email address.")
		   return false
		}
		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
		{
		   alert("Invalid email address. Please enter a valid email address.")
		   return false
		}
		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr || str.substring(lastdot+1)=="")
		{
		    alert("Invalid email address. Please enter a valid email address.")
		    return false
		}
		 
		 if (str.indexOf(at,(lat+1))!=-1)
		 {
		    alert("Invalid email address. Please enter a valid email address.")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
		 {
		    alert("Invalid email address. Please enter a valid email address.")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1)
		 {
		    alert("Invalid email address. Please enter a valid email address.")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1)
		 {
		    alert("Invalid email address. Please enter a valid email address.")
		    return false
		 }
		 if(CharsInBag(str)==false)
		 {
		    alert("Invalid email address. Please enter a valid email address.")
		    return false
		 }
		 var arrEmail=str.split("@")
		 var ldot=arrEmail[1].indexOf(".")
		 if(isInteger(arrEmail[1].substring(ldot+1))==false){
		    alert("Invalid email address. Please enter a valid email address.")
		    return false
		 }
 		 return true					
	}

function doSubscribe()
{
	if (document.newsletter.newsname.value==""){alert("Please enter your name to subscribe to our newsletter");return false;}
	
	var emailID=document.newsletter.newsemail
	
	if ((emailID.value==null)||(emailID.value==""))
	{
		alert("Please enter your email address to subscribe to our newsletter");
		emailID.focus();
		return false;
	}
	if (echeck(emailID.value)==false)
	{
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
}
	
/***********************************************
* Cross browser Marquee II-  Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

var delayb4scroll=1000 
var marqueespeed=1 
var pauseit=1 

var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var actualwidth=''

function scrollmarquee(){
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+"px"
else
cross_marquee.style.left=parseInt(marqueewidth)+8+"px"
}

function initializemarquee(){
cross_marquee=document.getElementById("vmarquee")
cross_marquee.style.left=0
marqueewidth=document.getElementById("marqueecontainer").offsetWidth
actualwidth=cross_marquee.offsetWidth
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ 
cross_marquee.style.width=marqueewidth+"px"
cross_marquee.style.overflow="scroll"
return
}
setTimeout('lefttime=setInterval("scrollmarquee()",30)', delayb4scroll)
}

if (window.addEventListener)
window.addEventListener("load", initializemarquee, false)
else if (window.attachEvent)
window.attachEvent("onload", initializemarquee)
else if (document.getElementById)
window.onload=initializemarquee
