// $(document).ready(function() {
// $(window).load(function() {
	// $("#autopop1").dialog({
		// autoOpen : false,
		// resizable:false,
		// modal: true,
		// zIndex:10000,
		// width: 640,
		// height:365,
		// speed:500,
		// show: 'explode',
		// hide:'explode'
	// }).parents(".ui-dialog").find(".ui-dialog-titlebar").css({'background':'none','border':'none'});		
	// $( "#autopop1" ).dialog().parents(".ui-dialog").find(".ui-icon-closethick").css({'background-color':'#999'});
		
	// if( !$.cookie("autopopcookie")){
		// $.cookie("autopopcookie", "seen");
		// $("#autopop1").dialog('open');
	// }
	// // $.cookie("autopopcookie", null);
	// $("body").delegate(".autopopbutton", 'click', function(){
		// $("#autopop1").dialog('open');
	// });	
// });		

	
	$("a.menutop").each(function() {
		var locx = $(this).offset();
		$(this).next(".submenudiv").offset({ top: (locx.top+15), left: locx.left+12 });
	}); 

	  

	$("a.menutop").hover(
	  function () {
		// $("#headerblock").css({'background-image':'url(images/logo_name_hover.png)'},600);
		// alert("ok");
		$(".jqflash").hide();			// hide/Show Flash Div as Flash is always on top of every element
		var oThis = $(this);
		$(".submenudiv").stop(true, true).hide();
		$(this).next(".submenudiv").each(function(){	
			$(this).fadeIn();
			// setShadow($(this));			
		});
	  }, 
	  function () {
		// $("#headerblock").css({'background-image':'url(images/logo_name.png)'},600);
		$(this).next(".submenudiv").delay(600).fadeOut(600);
		// $('#thisshadow').hide();
		$(".jqflash").show();			// hide/Show Flash Div as Flash is always on top of every element
	  }
	);

	

	$(".submenudiv").hover(
	  function () {		
		$(".jqflash").hide();			// hide/Show Flash Div as Flash is always on top of every element
		$(this).stop(true, true).show();
		$(this).prev("a.menutop").addClass("menutop_sele");
		// setShadow($(this));		
	  }, 

	  function () {		
		// $('#thisshadow').hide();
		$(this).prev("a.menutop").removeClass("menutop_sele");
		$(this).fadeOut(600);
		$(".jqflash").show();			// hide/Show Flash Div as Flash is always on top of every element
	  }	
	);

	document.write("<div id='thisshadow' style='display:none; position:absolute; background:black; opacity:0.4;filter:alpha(opacity=40)' class='ui-corner-all'></div>");
	function setShadow(oThis){		// Shadow for SubmenuDiv
		// alert("ok");
		
		// alert($(oThis).css('zIndex'));
		$('#thisshadow').css({
			// position: 'absolute',
			width: ($(oThis).width() + 5) + 'px',
			height: ($(oThis).height() + 10) + 'px',
			// backgroundColor: '#DFDFDF',
			zIndex: ($(oThis).css('zIndex') - 1),
			top: ($(oThis).offset().top + 5) + 'px',
			left: ($(oThis).offset().left + 10) + 'px'
		});	
		// alert($('#thisshadow').css('zIndex'));
		// $('#thisshadow').html( $(oThis).html() );
		$('#thisshadow').show();
	}

	$("a.jqpop").click(function(){
		var linky = $(this).attr('href');	
			// alert(linky);
		var titley = "Ansal Institute: " + $(this).html();
		newWindu(linky);
		 // showHTML(linky, titley, '80%', '400', 'true', 'true')
		return false;
	});	

	// $.fn.equalizeHeights = function(){

	  // return this.height( Math.max.apply(this, $(this).map(function(i,e){ return $(e).height() }).get() ) )

	// }

	function showHTML(linky, titley, wX, hX, resz, modal_T, linkORhtml){		
		$("#msgpop").html('... loading ...');
		if(linkORhtml == "html"){
			$("#msgpop").html(linky);
		} else {
			if(linky){	$("#msgpop").load(linky); }
		}

		$("#msgpop").dialog({	
			// autoOpen	: false,
			width		: wX?wX:'auto',
			height		: hX?hX:'auto',
			resizable	: resz?resz:true,
			modal		: modal_T?modal_T:true,
			position	: ['center','center'],
			title		: titley?titley:'Ansal Institute',
			show		: 'explode',
			speed		: 500,
			hide		: 'explode'			
		});	

		$("#msgpop").dialog("open");
		return false;
	}

	// $(".jqtransferthis").attr('title','click to enlarge');
	
	$(".jqtransferthis").click(function(){
		$(".jqtransferthis").show(200);
		$(this).hide(200, function(){
			$(".jqtransferbox").hide(200).html( $(this).html() ).show(200);
			
			var topX = ($(".jqtransferbox").position().top) - 30;
			$('html, body').animate({scrollTop:topX}, 'slow');	
			
			$(".jqtransferbox").children('.jqhide').html('<span>click here to hide</span>');
			$(".jqtransferbox").children('iframe').show(200);
			$(this).appendTo("#slides");
		});
	});
	
	$(".jqtransferbox").click(function(){
		$(this).hide(200, function(){
			$(this).html('');
			$(".jqtransferthis").show(200);
		});		
	});
	
$(document).ready(function() {
	$("a.linkleft").each(function(){
		// $("#msgpop").append($(this).attr('href')+"<br/>");
		var thisHref = $(this).attr('href');
		if( thisHref && (location.href).search( thisHref ) >= 0 ){
			// alert(location.href + " = " + $(this).attr('href'));
			// $(this).css({'color':'#0077CC'});
			$(this).removeClass('linkleft');
			$(this).addClass('linkleftsele');			
		}
	});
	
	$(".jqclicktoref").click(function(){ location.href = $(this).attr('href');});

	$(".jstognext").each(function(){
		$(this).attr('title', 'click to hide/ show');
		$(this).css({'cursor':'pointer'});
		$(this).click(function(){ $(this).next().toggle(600, 'linear'); return false; });
	});
	
	$(".jsscrolllink").click(function(){			// Show/ Hide
		var hasVal = $(this).attr('title');
		var title2 = $(this).attr('title2');
		if(title2){ hasVal = title2; }
		var oModule = $("#"+hasVal);
		// alert(oModule);
		$(".jqsection").hide();
		// $(oModule).fadeIn(900,'linear');
		// $(oModule).show('slide',{direction:'up'},600);
		$(oModule).show(600, 'linear');
		$(".jsscrolllink").removeClass('selected');
		$(this).addClass('selected');
		$(".subpageHead").html( $(this).html() );
		$(this).focus();
		return false;			
	});

	$(".jsdefault, jqdefault").each(function(){			// Show/ Hide
		var hasVal = $.trim($(this).attr('title'));
		if(hasVal){
			var oModule = $("#" + hasVal);
			$(oModule).show();
			$(this).addClass('selected');	
			$(".subpageHead").html( $(this).html() );
		}
	});	
	
	// $("#wholediv").show(1200);
	$(".jqproghover").click(function(){		
		showHTML('academicprogram/program.pop.list.php', 'Academic Programs', 500, 400, '', '', '');
		return false;

	});

	$("#rightColShow").animateElementShow({delay:5000, speed:600});
	
	
	// $(".rightcol").height( $("#middleblock").height() );
	
});	
	// $("a").click(function(){
		// _gaq.push(['_trackEvent', $(this).attr("href")]);
	// });
