var feature_interval = 5; 
feature_interval *= 1000;
var lightboxNum = 0;
var w=1;
var firstTime = true;
var homePage = false;

$(document).ready(function(){  			   
						   
  	$("li.mainitem").hover(function() { 

        $(this).find("ul.dropmenu").slideDown("fast").show(); 
		$(this).children("a").addClass("hover"); 
  
    }, function(){  
        $(this).find("ul.dropmenu").slideUp("fast");
		$(this).children("a").removeClass("hover");
    });
	
	if(homePage) {
  		for (i in document.links) {
    		link = document.links[i];
    		if (link.rel && link.rel.indexOf('lightbox-tour')!=-1) {
      			lightboxNum++;
    		}
  		}
  
  		for(z=2; z <= lightboxNum; z++){
	   		$("a#pic"+z).fadeOut(100);
  		}
  		if(lightboxNum>0){
	  		rotateImage();
  		}
	}
});  

//Paypal Form
function donateNow(){
	document.getElementById("aspnetForm").method = "post";	
	document.getElementById("aspnetForm").action = "https://www.paypal.com/cgi-bin/webscr";
	document.getElementById("aspnetForm").submit();
}


function rotateImage() {
	if(firstTime) { 
		firstTime = false ;
	} else { 
		$("a#pic"+w).fadeOut(500, function(){ 
			w = (w < lightboxNum) ? w+1: 1 ;
			$("a#pic"+w).fadeIn(500);
		});
	}
	var recur_call = "rotateImage()";
	setTimeout(recur_call, feature_interval);
}

//IE image caching
try { document.execCommand('BackgroundImageCache', false, true); }
catch(e) {}

