/*********************
//* jQuery Multi Level CSS Menu #2- By Dynamic Drive: http://www.dynamicdrive.com/
//* Last update: Nov 7th, 08': Limit # of queued animations to minmize animation stuttering
//* Menu avaiable at DD CSS Library: http://www.dynamicdrive.com/style/
*********************/

//Specify full URL to down and right arrow images (23 is padding-right to add to top level LIs with drop downs):
var arrowimages={down:['downarrowclass', 'down.gif', 0], right:['rightarrowclass', 'right.gif']}
var $padding_m=screen.width*1/100-4;
var my=new Array();
//alert(screen.width);
var sBrowser = navigator.userAgent;

//if (sBrowser.toLowerCase().indexOf('msie') > -1) {$padding_m=screen.width*1/100-4;}else{$padding_m=screen.width*1/100-4;}
//alert($padding_m);
var jqueryslidemenu={

animateduration: {over: 0, out: 0}, //duration of slide in/ out animation, in milliseconds
buildmenu:function(menuid, arrowsvar){
	jQuery(document).ready(function($){
		var $mainmenu=$("#"+menuid+">ul")
		var $headers=$mainmenu.find("ul").parent()
		
		 $(".dropdown").each( function (a) { 
		 	$(this).children("li").each( function (i) { 
				
				//cap 1
		 		$(this).children("ul").each( function (j) { 
					var  $max_width = 200; 
		 			 $(this).children("li").each( function (k) { 
						//Menu cap 2
		 			 	 $(this).children("ul").each( function (l) {  
							var $child_max_width = 200;
		 			 	 	 $(this).children("li").each( function (m) { 
								 $this_width = $("a", this).text().length*8;
								 //alert($this_width);
								 if ($this_width >= $child_max_width) {
									$child_max_width = $this_width;
								 } 
							});
							//alert($child_max_width);
							$(this).width($child_max_width);	 
		 			 	 });
		 			 	 //$this_width = $("a", this).width();
						 $this_width = $("a:first", this).text().length*8;//find("a:first")
						 //alert($this_width);
						 if ($this_width >= $max_width) {
							 $max_width = $this_width;
						 }
		 			 });
					  $(this).width($max_width); 
		 		});
		 	});
		 });
		 //
		 //$("ul.dropdown li ul li:has(ul)").find("a:first").append(" &laquo; ");
    	 //$("ul.dropdown li ul li:has(ul.left)").find("a:first").append(" &raquo; ");
		$headers.each(function(i){
			var $curobj=$(this)
			var $subul=$(this).find('ul:eq(0)')
			this._dimensions={w:this.offsetWidth, h:this.offsetHeight, subulw:$subul.outerWidth(), subulh:$subul.outerHeight()}
			this.istopheader=$curobj.parents("ul").length==1? true : false
			$subul.css({top:this.istopheader? this._dimensions.h+"px" : 0})
			$curobj.children("a:eq(0)").css(this.istopheader? {paddingRight: arrowsvar.down[2]} : {});/*.append(
				'<img src="'+ (this.istopheader? arrowsvar.down[1] : arrowsvar.right[1])
				+'" class="' + (this.istopheader? arrowsvar.down[0] : arrowsvar.right[0])
				+ '" style="border:0;" />'
			)*/

			$curobj.hover(
				function(e){
					var $targetul=$(this).children("ul:eq(0)")
					//alert($targetul.parent("li").width());
					var $mylove=0;
					//alert($targetli.width())
					this._offsets={left:$(this).offset().left, top:$(this).offset().top }
					if(screen.width==1280){
						if (sBrowser.toLowerCase().indexOf('msie') > -1){$mylove=(screen.width-$(this).offset().left-242 -$(this).width());}
						else if(sBrowser.toLowerCase().indexOf('opera')>-1){
							$mylove=(screen.width-$(this).offset().left-238 -$(this).width());
						}
						else{
							$mylove=(screen.width-$(this).offset().left-237 -$(this).width());
						}
						
					}else if(screen.width==1024){
						if (sBrowser.toLowerCase().indexOf('msie') > -1  ){$mylove=(screen.width-$(this).offset().left-114 -$(this).width());}else{
							$mylove=(screen.width-$(this).offset().left-109 -$(this).width());
						}
						//$mylove=(screen.width-$(this).offset().left-114-$(this).width());
					}
					//alert(this._dimensions.w)
					var menuleft=this.istopheader? 0 : this._dimensions.w
					//var $padds=$(window).width()-screen.width*1/10-(this._offsets.left+menuleft+this._dimensions.subulw);
					menuleft=(this._offsets.left+menuleft+this._dimensions.subulw>$(window).width()-screen.width*1/10)? (this.istopheader? -this._dimensions.subulw+this._dimensions.w+$mylove+5 : -this._dimensions.w+this._dimensions.w-$(this).children("ul:eq(0)").width()) : menuleft
					//alert(menuleft);
					
					if ($targetul.queue().length<=1) //if 1 or less queued animations
						$targetul.css({/*/*/left:menuleft+"px"/*/*/,width:this._dimensions.subulw+'px'}).slideDown(jqueryslidemenu.animateduration.over)
						//alert(menuleft)
					//alert($targetul.children("li:has(ul)").find("a:first").width());
						/*if(menuleft>=$targetul.children("li:has(ul)").find("a:first").width()){
							$targetul.children("li:has(ul)").find("a:first").css({background:"url('images/top-menu.png') no-repeat scroll 100% 50%"});
							
						}else if(menuleft<$targetul.children("li:has(ul)").find("a:first").width()){
							$targetul.children("li:has(ul)").find("a:first").css({background:"url('images/top-menu2.png') no-repeat scroll 0 50%"});
						}*/
				},
				function(e){
					var $targetul=$(this).children("ul:eq(0)")
					$targetul.slideUp(jqueryslidemenu.animateduration.out)
				}
				
			) //end hover
			
		}) //end $headers.each()
		
		$mainmenu.find("ul").css({display:'none', visibility:'visible'})
	}) //end document.ready
}
}

//build menu with ID="myslidemenu" on page:
jqueryslidemenu.buildmenu("myslidemenu", arrowimages)
//INSERT INTO `movieinfo` (id ,name,genre)VALUES
