// JavaScript Document

function submitform()
{
	if ((document.form.name.value=="")||(document.form.addr.value=="") || (document.form.telno.value=="") || (document.form.email.value=="")||(document.form.cell.value==""))
		
		{
			
			alert("Please fill all required (*)fields.");
		}	
		else
		{
		var emailID=document.form.email.value;
	
		if (echeck(emailID)==false)
		{
			
			document.form.email.focus();
			
		}
		else
		{
			document.form.submit();	
			
		}
		
		}
}


function resetform()
{
document.form.name.value="";
document.form.addr.value="";	
document.form.telno.value="";
document.form.cell.value="";
document.form.email.value="";
document.form.help.value="";
document.form.hosting.value="";
document.form.sponser.value="";
document.form.activities.value="";
document.form.literature.value="";
document.form.phone.value="";
document.form.bumper.value="";
document.form.tshirt.value="";
document.form.campaign.value="";
document.form.cevent.value="";
document.form.yardsign.value="";
document.form.myyard.value="";
document.form.door.value="";
document.form.thewave.value="";
document.form.poll.value="";
document.form.twitter.value="";
document.form.cskill.value="";
document.form.day.value="";
document.form.time.value="";
document.form.invite.value="";
document.form.invite1.value="";
}



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					
	}	
	
	

var currentPage = "bio1";

function openPop(pageurl)
{
	var a;
	var pageindex;
	a=window.open(pageurl +'.html','','left=60,top=60,width=600,height=470,status=1');
	//var popup=a.split('=');
	//document.body.innerHTML =popup[0];
}


function openLink(obj)
 {
	
	window.open (obj + ".html", "_self");
 }

function makeScrollbar(content,scrollbar,handle,horizontal,ignoreMouse){
		//alert('coming');
				var steps = (horizontal?(content.getScrollSize().x - content.getSize().x):(content.getScrollSize().y - content.getSize().y))
				var slider = new Slider(scrollbar, handle, {	
					steps: steps,
					mode: (horizontal?'horizontal':'vertical'),
					onChange: function(step){
					
						// Scrolls the content element in x or y direction.
						var x = (horizontal?step:0);
						var y = (horizontal?0:step);
						content.scrollTo(x,y);
					}
				}).set(0);
				if( !(ignoreMouse) ){
					// Scroll the content element when the mousewheel is used within the 
					// content or the scrollbar element.
					$$(content, scrollbar).addEvent('mousewheel', function(e){	
						e = new Event(e).stop();
						var step = slider.step - e.wheel * 30;	
						slider.set(step);					
					});
				}
				// Stops the handle dragging process when the mouse leaves the document body.
				$(document.body).addEvent('mouseleave',function(){
										slider.drag.stop()});
			}
						
	window.addEvent('domready', function(){	
						
				// -- first example, vertical scrollbar --
				makeScrollbar( $('content1'), $('scrollbar1'), $('handle1'));
				// -- second example, horizontal scrollbar --
				//makeScrollbar( $('content2'), $('scrollbar2'), $('handle2'),false);
				//// -- third example, horizontal and vertical scrollbars
				//makeScrollbar( $('content3'), $('scrollbar3'), $('handle3'),false);
				//makeScrollbar( $('content4'), $('scrollbar4'), $('handle4'),false);	
				//makeScrollbar( $('content5'), $('scrollbar5'), $('handle5'),false);
			});
			/* ]]> */
			
			
			
			
			function setImg(obj)
{
	//alert('coming');
	
	obj.style.cursor=  "Pointer";
	obj.style.backgroundImage = "url('images/" + obj.id + "_over.png')";
	
}

function resetImg(obj)
{
	if (currentPage != obj.id)
	obj.style.backgroundImage = "url('images/" + obj.id + "_back.png')";
	
}
