// JavaScript Document

// JavaScript Document

function swapimage(targetpic,rolloverpic) {
	document.getElementById(targetpic).src="images/"+rolloverpic+".jpg";
}

// JavaScript Document

function theRotator() {
	//Set the opacity of all images to 0
	$('div#rightbox_launches div').css({opacity: 0.0});
	
	//Get the first image and display it (gets set to full opacity)
	$('div#rightbox_launches div:first').css({opacity: 1.0});
		
	//Call the rotator function to run the slideshow, 6000 = change to next image after 6 seconds
	setInterval('rotate()',4000);
	
}

function rotate() {	
	//Get the first image
	var current = ($('div#rightbox_launches div.show')?  $('div#rightbox_launches div.show') : $('div#rotator ul li:first'));

	//Get next image, when it reaches the end, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div#rightbox_launches div:first') :current.next()) : $('div#rightbox_launches div:first'));	
	
	//Set the fade in effect for the next image, the show class has higher z-index
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000);

	//Hide the current image
	current.animate({opacity: 0.0}, 1000)
	.removeClass('show');
	
};

$(document).ready(function() {		
	//Load the slideshow
	theRotator();
});





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 ValidateForm(){
	var emailID=document.getElementById('form_email');
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }





// JavaScript Document

function theRotator2() {
	//Set the opacity of all images to 0
	$('div#leedswebdesigntwitter3 p').css({opacity: 0.0});
	
	//Get the first image and display it (gets set to full opacity)
	$('div#leedswebdesigntwitter3 p:first').css({opacity: 1.0});
		
	//Call the rotator function to run the slideshow, 6000 = change to next image after 6 seconds
	setInterval('rotate2()',4000);
	
}

function rotate2() {	
	//Get the first image
	var current = ($('div#leedswebdesigntwitter3 p.show')?  $('div#leedswebdesigntwitter3 p.show') : $('div#rotator2 ul li:first'));

	//Get next image, when it reaches the end, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div#leedswebdesigntwitter3 p:first') :current.next()) : $('div#leedswebdesigntwitter3 p:first'));	
	
	//Set the fade in effect for the next image, the show class has higher z-index
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000);

	//Hide the current image
	current.animate({opacity: 0.0}, 1000)
	.removeClass('show');
	
};

$(document).ready(function() {		
	//Load the slideshow
	theRotator2();
});


function redir(loc) {
this.location.href=loc;
}

