// JavaScript Document
  var player;
    var THUMB_PREVIEW_TIMER;

function mousOverImage(name,id,nr, bSize, bColor){

	if(name)
		imname = name;

	imname.style.border = 	bSize+'px solid #'+bColor;

	imname.src = "http://img.youtube.com/vi/"+id+"/"+nr+".jpg";
	nr++;
	if(nr > 3)
		nr = 1;
	THUMB_PREVIEW_TIMER =  setTimeout("mousOverImage(false,'"+id+"',"+nr+", '"+bSize+"', '"+bColor+"');",600);

}


function mouseOutImage(name, bSize, bColor){

	if(name)
		imname = name;

	imname.style.border = 	bSize+'px solid #'+bColor;
	if(THUMB_PREVIEW_TIMER)
		clearTimeout(THUMB_PREVIEW_TIMER)

}
	function setmylayout()
	{
		 var pagewidth = $(document).width();
		if(pagewidth<1134)
		{
			wrapperWidth = 1080;
			$('#wrapper').width(wrapperWidth);
			
		}else
		{
			$('#wrapper').width('97%');
			
		}
		if(pagewidth<1070)
		{
			$('.l_det').css("display","none");
		}else
		{
			$('.l_det').css("display","block");
		}
			var wrapperWidth = $('#wrapper').width();
			var VideoPlayerWidth =  $('#player').width();
			var adAreaWidth = $('#rightpanel').width()+8;
			var leftpanelWidthWill = (wrapperWidth - adAreaWidth)-5;
			$('#leftpanel').width(leftpanelWidthWill);
			var leftpanelWidthWill =  $('#leftpanel').width();
			var latestvideoWidthWill = (leftpanelWidthWill - VideoPlayerWidth)-18 ;
			$('#latestvideo').width(latestvideoWidthWill);
			
			var imagewidth = $('.l_img').width();
			
			$('.l_det').width((latestvideoWidthWill-imagewidth)-25);
			$('.l_det').height($('.l_img').height()-8);
			//alert('leftpanelWidthWill = '+latestvideoWidthWill+' , imagewidth = '+imagewidth+' ,  detail = '+(latestvideoWidthWill-imagewidth) );
		
	}
	$(document).ready(function() {
	  setmylayout();
	  var player = $('#ply');
	   //menu starts here
	   var varsubul_w = $('.subul').width()-($('.subcatmenu').width()/2);
	   $('.subul').css({'marginLeft': -varsubul_w});
	  function show() {
         var menu = $(this);
         menu.children(".subul").slideDown();
       }
      
       function hide() { 
        var menu = $(this);
       menu.children(".subul").slideUp();
      }
    
      $(".subcatmenu").hoverIntent({
        sensitivity: 1, // number = sensitivity threshold (must be 1 or higher)
        interval: 50,   // number = milliseconds for onMouseOver polling interval
        over: show,     // function = onMouseOver callback (required)
        timeout: 300,   // number = milliseconds delay before onMouseOut
        out: hide       // function = onMouseOut callback (required)
      });
  
	   //menu finish here
	  $('#searchnow').click(function(){
			var query = $('#q').val();
			if(query!='')
			{
			document.location = sitepath+'search/?q='+query;
			}
		});
	 
	});
	$(window).resize(function() {
	  setmylayout();
	  // var pagewidth = $(document).width();
		//alert(pagewidth);
	});
