function loadMenu()
{
	$('.top-down').slideDown('slow');
	$('.quick-content').mouseover(function(){$('.top-down').show();});
	$('.top-down').mouseout(function(){$('.top-down').hide();});
}

function logIn()
{
	$('#popup').children('img.close').click(function(){$('#popup-container').css('display','none');$('#popup').fadeOut();});
	$('#popup-container').click(function(){$(this).css('display','none');$('#popup').fadeOut();});
	if($('.subscription-form').length > 0)
	{
		$('.subscription-form').validate();	
	}
}

function showPop()
{
	$('#popup-container').css('display','block'); $('#popup').fadeIn('50');
}


/*if (document.all||document.getElementById)
document.write('<span id="worldclock" style="font:bold 16px Arial;"><\span><br />')*/

zone=0;
isitlocal=true;
ampm='';

function updateclock(z){
zone=z.options[z.selectedIndex].value;
isitlocal=(z.options[0].selected)?true:false;
}

function WorldClock(){

now=new Date();
ofst=now.getTimezoneOffset()/60;
secs=now.getSeconds();
sec=-1.57+Math.PI*secs/30;
mins=now.getMinutes();
min=-1.57+Math.PI*mins/30;
hr=(isitlocal)?now.getHours():(now.getHours() + parseInt(ofst)) + parseInt(zone);
hrs=-1.575+Math.PI*hr/6+Math.PI*parseInt(now.getMinutes())/360;
if (hr < 0) hr+=24;
if (hr > 23) hr-=24;
ampm = (hr > 11)?"PM":"AM";
statusampm = ampm.toLowerCase();

hr2 = hr;
if (hr2 == 0) hr2=12;
(hr2 < 13)?hr2:hr2 %= 12;
if (hr2<10) hr2="0"+hr2;

var finaltime=hr2+':'+((mins < 10)?"0"+mins:mins)+':'+((secs < 10)?"0"+secs:secs)+' '+statusampm;

//if (document.all)
//worldclock.innerHTML=finaltime
//else if (document.getElementById)
//document.getElementById("worldclock").innerHTML=finaltime
$('.worldclock').html(finaltime);
//else if (document.layers){
//document.worldclockns.document.worldclockns2.document.write(finaltime);
//document.worldclockns.document.worldclockns2.document.close();
//}


setTimeout('WorldClock()',1000);
}

//window.onload=WorldClock();


function checkAll()
{
	if($('#check_all').attr('checked')==true)
	{
		$('.check_project').attr('checked',true);
	}else
	{
		$('.check_project').removeAttr('checked');	
	}
}

function verify()
{
	if(confirm('Are you sure you want to delete seleted projects'))	
	{
		$('.projects').submit();	
	}else{return false;}
}
function tabHandler()
{
	$('.tab:eq(0)').addClass('active');
	$('.tab-content:eq(0)').addClass('tabactive');
	$('span.prev').hide();
	$('.tab-content:eq(0)').fadeIn('slow');
			var obj=$('.tab-content:eq(0)');
			$.post("/loadvideo.php", { url: $('.tab:eq(0)').attr('id'),width:483,height:263}, function(data) {
					obj.children('.video').html(data);
				});
	$('.tab').click(function(){
		if($(this).hasClass('active')!=true)
		{
			$('.tab-content').hide().removeClass('tabactive');
			$('.tab').removeClass('active');
			$(this).addClass('active');
			
			$('.tab-content:eq('+$('.tab').index(this)+')').fadeIn('slow').addClass('tabactive');
			var obj=$('.tab-content:eq('+$('.tab').index(this)+')');
			$.post("/loadvideo.php", { url: $(this).attr('id'),width:483,height:263}, function(data) {
					obj.children('.video').html(data);
				});
			if($('a.active').prev('a.tab').length <= 0)
			{
				$('span.prev').hide();	
			}else
			{
				
				$('span.prev').show();	
			}
			if($('a.active').next('a.tab').length <= 0)
			{
				$('span.next').hide();	
			}else
			{
				$('span.next').show();	
			}
		}
	});
	
	$('span.tabMov').click(function(){
		if($(this).hasClass('next'))
		{
			if($('a.active').next('a.tab').length > 0)
			{
				$('a.active').next('a.tab').addClass('nexttab');
				$('a.active').removeClass('active');
				$('.nexttab').removeClass('nexttab').addClass('active');
				$('div.tabactive').next('div.tab-content').addClass('nexttab');
				$('div.tabactive').removeClass('tabactive').hide();
				$('.nexttab').removeClass('nexttab').addClass('tabactive').fadeIn('slow');
				
				
			var obj=$('.tabactive');
			$.post("/loadvideo.php", { url: $('a.active').attr('id'),width:483,height:263}, function(data) {
					obj.children('.video').html(data);
				});
				
				if($('a.active').next('a.tab').length <= 0)
				{
					$('span.next').hide();	
				}else
				{
					$('span.next').show();	
				}
				if($('a.active').prev('a.tab').length <= 0)
				{
					$('span.prev').hide();	
				}else
				{
					$('span.prev').show();	
				}
			}
		}else
		{
			if($('a.active').prev('a.tab').length > 0)
			{
				$('a.active').prev('a.tab').addClass('nexttab');
				$('a.active').removeClass('active');
				$('.nexttab').removeClass('nexttab').addClass('active');
				$('div.tabactive').prev('div.tab-content').addClass('nexttab');
				$('div.tabactive').removeClass('tabactive').hide();
				$('.nexttab').removeClass('nexttab').addClass('tabactive').fadeIn('slow');
				
				
			var obj=$('.tabactive');
			$.post("/loadvideo.php", { url: $('a.active').attr('id'),width:483,height:263}, function(data) {
					obj.children('.video').html(data);
				});
				
				if($('a.active').prev('a.tab').length <= 0)
				{
					$('span.prev').hide();	
				}else
				{
					
					$('span.prev').show();	
				}
				if($('a.active').next('a.tab').length <= 0)
				{
					$('span.next').hide();	
				}else
				{
					$('span.next').show();	
				}
			}	
		}
	});
}
/***********/
function scrollBanner()
{
	var count=$('.banner-item').length;	
	$('img.move-left').click(function(){
		$('#scrolling').animate({marginLeft:'-413px'},'slow');
		setTimeout('moveLeft()',700);
	});
	$('img.move-right').click(function(){
		$('#scrolling').animate({marginLeft:'413px'},'slow');
		setTimeout('moveRight()',700);
	});
}

	function moveLeft()
	{
		$obj=$('#scrolling').children('.banner-item:first');
		$('#scrolling').children('.banner-item:first').remove();
		$('#scrolling').append('<div class="banner-item">'+$obj.html()+'</div>');
		$('#scrolling').css('margin-left','0px');	
	}
	function moveRight()
	{
		$obj=$('#scrolling').children('.banner-item:last');
		$('#scrolling').children('.banner-item:last').remove();
		$('#scrolling').html('<div class="banner-item">'+$obj.html()+'</div>'+$('#scrolling').html());
		$('#scrolling').css('margin-left','0px');
	}

function topTabs()
{
	$('.top-tab').click(function(){
		$('.top-tab').removeClass('active');
		$(this).addClass('active');
			$('.top-tab-content').hide();
			$(".banner").html('<img src="/siteimages/images/loadingAnimation.gif" alt="Loading"  class="loading" />');
			$('.top-tab-content:eq('+$('.top-tab').index(this)+')').fadeIn('slow');
			$.post("/loadvideo.php", { url: $(this).attr('id'),width:464,height:260}, function(data) {
							$(".banner").html(data);
			});
	});
}

function bannerTab(){
	$('p#banner_tab span.move').click(function(){
		if($(this).hasClass('next'))
		{
			if($('span.active').next('.main-tab').length >0)
			{
				$('span.active').removeClass('active').next('.main-tab').addClass('active');
				$('.tab_active').removeClass('tab_active').next('.banner-tab').addClass('tab_active');
			}
		}else
		{
			if($('span.active').prev('.main-tab').length >0)
			{
				$('span.active').removeClass('active').prev('.main-tab').addClass('active');
				$('.tab_active').removeClass('tab_active').prev('.banner-tab').addClass('tab_active');
			}	
		}
	});
	
	$('p.child-tab a.ctab').click(function(){
		if($(this).hasClass('cactive')!=true)
		{
			$('.tab_active').children('p.child-tab').children('.ctab').removeClass('cactive');
			$(this).addClass('cactive');
			index=$('.tab_active').children('p.child-tab').children('.ctab').index(this);
			$('.tab_active').children('.child-tab-con').removeClass('childActive');
			$('.tab_active').children('.child-tab-con:eq('+index+')').addClass('childActive');
		}	
	})
	
	$('h3#tabContorl').click(function(){
		if($(this).hasClass('active')!=true)
		{
			$(this).addClass('active');
			$('.header-tab-container').slideDown();
		}else
		{
			$(this).removeClass('active');
			$('.header-tab-container').slideUp();
		}
	});
	
}

