var $j = jQuery.noConflict() 


/*
 * jQuery (TY) Drop Down Mega Menu 
 * http://tumharyyaaden.site50.net/
 *
 * Copyright (c) 2009 Ronak Patel 
 * Desisaswat@gmail.com
 * Dual licensed under the MIT and GPL licenses.
 *
 * Date: 2010-05-19 00:00:01 -0500 (Wed, 19 May 2010)
 * Version: 0.1
 */

$j(document).ready(function(){

    $j(".tiptip").tipTip(); //Initiate tipTip Tooltip, Titles to Tooltip
	
	//Top Navigation Background Animation, inlcude bgpos.js!
	$j('#top_navi a') //Top Navigation Background Animation, inlcude bgpos.js!
		.css( {backgroundPosition: "-230px 0"} )
		.mouseover(function(){
			$j(this).stop().animate({backgroundPosition:"(0 0)"}, {duration:310});
		})
		.mouseout(function(){
			$j(this).stop().animate({backgroundPosition:"(-230px 0)"}, {duration:310});
		});
		
	$j('#top_navi .menuboth div a') //Top Navigation, Drop down Links Background Animation, inlcude bgpos.js!
		.css( {backgroundPosition: "-500px -10px"} )
		.mouseover(function(){
			$j(this).stop().animate({backgroundPosition:"(0 -10px)", paddingLeft:"21"}, {duration:500});
		})
		.mouseout(function(){
			$j(this).stop().animate({backgroundPosition:"(-500px -10px)", paddingLeft:"12"}, {duration:400});
		});
	
	//Drop-Down Menu	
	$j('.menuboth').mouseover(function(){
													  
		var containerID = '#'+$j('a:first-child', this).attr('menudata'); //Get Menu container ID
		var tall = $j('a:first-child', this).attr('menuheight'); //Get Menu container Height
		var wide = $j('a:first-child', this).attr('menuwidth'); //Get Menu container Width
		
		$j(containerID).stop().animate({height:tall, width:wide}, {queue:false, duration:500, easing:'easeOutBounce'});
	});
	
	//Hide Drop-Down Menu
	$j('.menuboth').mouseout(function(){
							  
		var containerID = '#'+$j('a:first-child', this).attr('menudata');
		
		$j(containerID).stop().animate({height:0,width:0},{queue:false, duration:400, easing: 'easeOutBounce'});
	});

		
	//SearchBox Text Value change function
	var searchfocus = false;		//Set if SearchBox is in focus
	
	$j("#searchtxt, #topsearchtxt").click(function(){
		if (this.value=='Search Here...') {
			$j(this).val(''); 
			searchfocus = true;		//Don't fade footer if SearchBox is in focus, ignore scroll fade
		}
	})
	.blur(function(){
		if ((this.value==' ')||(this.value=='')) {
			$j(this).val("Search Here..."); 
			searchfocus = false; 		//Fade footer if SearchBox is in blur and if page is not scrolled down
			
			var scrollTop = $j(window).scrollTop();
			if(scrollTop <= 100) {$j('#fixedfooter').stop().animate({'opacity':'0.3'},400);}
		}
		
	});		
	
});
