	function email_check(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 Address")
			   return false
 			}
	
			if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
			   alert("Invalid E-mail Address")
			   return false
			}
	
			if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
			    alert("Invalid E-mail Address")
			    return false
			}
	
			 if (str.indexOf(at,(lat+1))!=-1){
			    alert("Invalid E-mail Address")
			    return false
			 }
	
			 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
			    alert("Invalid E-mail Address")
			    return false
			 }
	
			 if (str.indexOf(dot,(lat+2))==-1){
			    alert("Invalid E-mail Address")
			    return false
			 }
			
			 if (str.indexOf(" ")!=-1){
			    alert("Invalid E-mail Address")
			    return false
			 }
	
	 		 return true					
		}
	
	function ValidateFormEmail(){
		var emailID=document.frmSample.email
		
		if ((emailID.value==null)||(emailID.value=="")){
			alert("Please Enter your Email ID")
			emailID.focus()
			return false
		}
		if (email_check(emailID.value)==false){
			emailID.value=""
			emailID.focus()
			return false
		}
		
		return true
	 }
      
	function toggleNewsletter() 
	{
		Effect.Combo('newsletterwrap', {duration: 0.8});
		if (document.getElementById('tab-a').className == 'tab-opened') {
			document.getElementById('tab-a').className = 'tab-closed';
		} 
		else 
		{
			document.getElementById('tab-a').className = 'tab-opened';
		}
	}
      
	$ = jQuery._$;
	$j = jQuery;

	function slideShowOU (old_tabname, tabname)
	{
		$j("#"+old_tabname).fadeOut("fast", function() {$j("#"+tabname).fadeIn("fast");}); 
	}

	var autoDiv = 1;
	var activeDiv = 0;
	var oldActiveDiv = 0;
	var activationTimer = setInterval('changeDiv()', 10000);

	function changeDiv()
	{
		if (autoDiv == 1)
		{
			oldActiveDiv = activeDiv;
			activeDiv = (activeDiv + 1) % 6;
			slideShowOU('ou_slide'+ oldActiveDiv, 'ou_slide'+ activeDiv);
		}
	}

	$j(document).ready(function()
	{
		$j("a.login_button").click(function()
		{ 
			$j("div.login_form").slideDown("slow");
			//$j("div.register_form").slideUp("slow"); 
		});
			 
		$j("a.login_cancel").click(function()
		{
			$j("div.login_form").slideUp("fast");
		});
					
		$j("a.register_button").click(function()
		{
			$j("div.register_form").slideDown("slow");
			$j("div.login_form").slideUp("slow"); 
		});

		$j("a.register_cancel").click(function()
		{
			$j("div.register_form").slideUp("fast");
		});
	});



var tabberOptions = {
'manualStartup':true,
'onLoad': function(argsObj) {
	/* Perform the automatic toggle of the newsletter div after one of the tabs has been loaded, here the first */

	 //alert('Finished loading the first tab!');
	 //toggleNewsletter();
}};

$j(document).ready(function(){
	$j('.email_address').focus(function(){
		if($j('.email_address').val() == "Enter Email")
		{
			$j('.email_address').val("");
		}
	});
});	

//Validate email address
function validEmail(ID)
{		
	var email_txt = "#" + ID;
	
	if(jQuery.trim($j(email_txt).val()) != "")
	{
		var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);				
		if(!pattern.test($j(email_txt).val()))
		{
			$j(email_txt).css('border', 'solid 1px red');
			alert("Email address is required");
			return false;
		}
		else
		{
			return true;
		}
	}
	else
	{
		$j(email_txt).css('border', 'solid 1px red');
		alert("Email address is required");
		return false;
	}
}	

//Validate newsletter radio buttons
function validRadio(ID)
{		
	//Validate newsletter
	if(!$j('#chk_ss').is(':checked') && !$j('#chk_h').is(':checked'))
	{
		alert("Please select at least one newsletter");
		return false;		
	}
	else
	{
		return validEmail(ID);
	}
}
