
// Target
function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}
window.onload = externalLinks;


// Toggle
$(document).ready(function(){

	$(".btn-slide").click(function(){
		$("#panel").slideToggle("slow");
		$(this).toggleClass("active"); return false;
	});
	
	 
});


// News Ticker Announcement
$(document).ready(
function(){
	$('#news').innerfade({
		animationtype: 'slide',
		speed: 750,
		timeout: 2000,
		type: 'random',
		containerheight: '1em'
	});


});


// News Slider Right Side

var height = 0;
			var to = null;
			var theAnimation;
			var newsScroller;
			$(document)
			.ready(function(){
				newsScroller = $('#newsScroller');
				
				var curSet = newsScroller
				.prev()
					.addClass('ns')
				.end()
				.wrap('<div>')
				.parent()
					.addClass('ns')
				.end()
				.wrap('<div>')
				.children()
				.slice(0,2)
				.each(function(){
					height += $(this).outerHeight(true);
				});
				
				theAnimation = function(){
					if( !newsScroller.is(':animated') ){
						newsScroller.animate({top:-height},1000,function(){
							height = 0;
							curSet = newsScroller
							.append(curSet)
							.css('top',0)
							.children()
							.slice(0,2)
							.each(function(){
								height += $(this).outerHeight(true);
							});
						});
					}
				};
				
				to = setInterval(theAnimation,4000);
				
				newsScroller.bind('mouseenter',function(){
					clearInterval(to);
				})
				.bind('mouseleave',function(){
					theAnimation();
					to = setInterval(theAnimation,4000);
				});
			});
			
			
// Images  Carousel
/*
stepcarousel.setup({
	galleryid: 'mygallery', //id of carousel DIV
	beltclass: 'belt', //class of inner "belt" DIV containing all the panel DIVs
	panelclass: 'panel', //class of panel DIVs each holding content
	autostep: {enable:true, moveby:1, pause:3000},
	panelbehavior: {speed:500, wraparound:false, persist:true},
	defaultbuttons: {enable: true, moveby: 1, leftnav: ['images/arrow-left.gif', -21, 35], rightnav: ['images/arrow-right.gif', 3, 35]},
	statusvars: ['statusA', 'statusB', 'statusC'], //register 3 variables that contain current panel (start), current panel (last), and total panels
	contenttype: ['inline'] //content setting ['inline'] or ['external', 'path_to_external_file']
})
*/


// Images  Carousel
function chk(){
if (document.frm.name.value==""){
alert ("Please enter your name");
document.frm.name.focus();
return false;
}
if (document.frm.email.value==""){
alert ("Please enter email address");
document.frm.email.focus();
return false;
}

if (document.frm.email.value.indexOf("@")<1){
alert ("Please enter valid email address");
document.frm.email.focus();
return false;
}

if (document.frm.email.value.indexOf(".")<1){
alert ("Please enter valid email address");
document.frm.email.focus();
return false;
}


if (document.frm.descr.value==""){
alert ("Please enter your message");
document.frm.descr.focus();
return false;
}
return verify();

return true;
}