function elemPos()
{
    var aHolders = new Array();
    var aReals = new Array();
    $('div').each(function (i){			  
		
		if($(this).attr('holder'))
		{
			var  pos = $(this).attr('holder');
			aHolders[pos] = $(this);
		}
		
		else if($(this).attr('real'))
		{
			var  pos = $(this).attr('real');
			aReals[pos] = $(this);
		}
	  
	  });
	  
	  for(i=0 ; i < aReals.length ; i++)
	  {
		if(aReals[i].height() > aHolders[i].height() )
		{
			aHolders[i].height(aReals[i].height());
			aHolders[i].width(aReals[i].width());
			
		}
		else if(aHolders[i].height() > aReals[i].height() )
		{
			aReals[i].height(aHolders[i].height());
			aReals[i].width(aHolders[i].width());					
		}
		var pos = $(aHolders[i]).offset();  
		var right =  pos.right + "px"; 
		var left =  pos.left + "px"; 
		var top = 	pos.top + "px"; 
		$(aReals[i]).css( { position: 'absolute',visibility: 'visible',left: left ,top: top} );				
	  }
	}


       	var searchVal = "Search (e.g. cast, crew)";
        $(document).ready(function() {
        	elemPos();
        	/*click on html to close all open popUp*/
        	 $(document).click(function(){$('.myMenuCover').hide();$('.searchAllFilesCover').hide();});
            /*End click on html to close all open popUp*/
            /*  cookie - featured links */            
        	if(getCookieValue('lineC') != 'x'){$('#line').show();}
        	
            /* marketing small bar hide */ 
            $('.closeMarket').click(function(){$(this).parent().hide();});
         	/*End marketing small bar hide */ 

			/* Search menu all file and all file choices*/
         	$('.searchAllFiles').click(function(e){ e.stopPropagation();$('.searchAllFilesCover').show();});
         	
         	$('.searchAllFilesChoices > ul > li > a').click(function(e){ e.stopPropagation();
            	$('.searchAllFilesChoices > ul > li > a').removeClass('imOn');
            	$(this).addClass('imOn');
            	$('#mode').attr('value', $(this).attr('rel'));
            	$('.selection').html($(this).html());
            	$('.searchAllFilesCover').fadeOut();              
            });
         	$('.searchAllFilesOn').click(function(e){ e.stopPropagation();$(this).parent().hide();});
            $('.myMenu').click(function(e){ e.stopPropagation();$('.myMenuCover').show();});
            $('.myMenuOn').click(function(e){ e.stopPropagation();$('.myMenuCover').hide();});
			/* End Search menu all file and all file choices*/
            
            /*Form Field Value Swap*/
    
               swapValues = [];
               $("#txtSearchTerm").each(function(i){
                   swapValues[i] = searchVal;
                   if ($.trim($(this).val()) == "")
                   {$('#txtSearchTerm').attr('value',  swapValues[i]);}
                   $(this).focus(function(){
                       if ($(this).val() == "Search (e.g. cast, crew)") {
                           $(this).val("");
                           chckSearch($(this));
                          }
                   }).blur(function(){
                       if ($.trim($(this).val()) == "") {
                           $(this).val(swapValues[i]);
                           chckSearch($(this));
                       }
                   });
                   chckSearch($(this));
               });
   			
            /*End Form Field Value Swap*/
			
            /*Hovering*/   
        	$(".searchBoxInner").hover( function () {$(this).addClass('searchBoxHover');},function (){$(this).removeClass('searchBoxHover');});
			/*End Hovering*/
			
        	/*Rating change */	
            //$('input[type=radio]').rating(); 
			/*End Rating change*/ 


           
        	  /*End sort by*/
        	  $('.ratingFrm').css('visibility','visible');
        	  elemPos();
        	
          });
    function chckSearch(obj)
    {
  
    	if( $(obj).val() == "Search (e.g. cast, crew)" || $.trim($(obj).val()) == ""  || $(obj).val() == "undefined")
    	{
    		$(".searchBtn > .searchBtnOff").show();
    		$(".searchBtn > .searchBtnOn").hide();
    	}
    	else
    	{
    		$(".searchBtn > .searchBtnOff").hide();
    		$(".searchBtn > .searchBtnOn").show();    		
    	}
    	
    }
	 
	 



	 function getDate()
	 {
	 	return new Date();
	 }

 

function getCookieValue (cookieName) {
	  var exp = new RegExp (escape(cookieName) + "=([^;]+)");
	  if (exp.test (document.cookie + ";")) {
	    exp.exec (document.cookie + ";");
	    return unescape(RegExp.$1);
	  }
	  else return false;
	}


