
        var searchVal = "Search (e.g. rock, video, fun)";
        $(document).ready(function() {
        if($.browser.msie)
        {
        	if($.browser.version < 7.0)
        	{
        		$('.footerContent').supersleight({backgrounds:true,apply_positioning:true,imgs:false});
        	}
 		
        }
 		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. rock, video, fun)") {
                           $(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');$('.selected').click();},function (){$(this).removeClass('searchBoxHover');});
			/*End Hovering*/
			
        	/*Rating change */	
            //$('input[type=radio].star').rating(); 
			/*End Rating change*/ 


           
        	  /*End sort by*/
        	  $('.ratingFrm').css('visibility','visible');
        	  //$('.bodyCover').fadeTo("5000", 1.0);
          });
        
		function popIt(id){
			clearAllErrMessages()
			clseIt('signUpop');
			var winH = $(window).height();
			var winW = $(window).width();  
			var scrH = $(window).scrollTop()		
	        //Set the popup window to center   
	        $("#"+id).css('top',  (winH/2-$("#"+id).height()/2)+ scrH );   
	        $(".popUp").css('left', winW/2-$("#"+id).width()/2);        
	        //transition effect   
	        $("#"+id).show();
			$("#"+id).easydrag(true);
			$("#"+id).setHandler("handle")
				$("#"+id).setHandler("handleUp")
			  	$(".dragoff").hover(
				      function () {
				    	  $("#"+id).dragOff();
				    	 
				      }, 
				      function () {
				    	  $("#"+id).dragOn();
				    	  $("#"+id).setHandler("handle");
				    	  $("#"+id).setHandler("handleUp");
				      }
				    );

			
				if(id == "signIpop")
				{
					if($("#chkRememberMe").attr('checked') == false){$('#mark').hide();	}
					else{$('#mark').show()}
					$("#txtEmail").attr('disabled','');
					$('#txtEmail').parents('div.inptInner').removeClass('disG');
					$(".forgot").show();
					$(".passwordToggle").hide();
					$(".passwordToggle[rel='1']").show();
				}
			}
		
		
			function clseIt(id){
				$("#"+id).hide();
				}

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} );				
	  }
	}


    function chckSearch(obj)
    {
  
    	if( $(obj).val() == "Search (e.g. rock, video, fun)" || $.trim($(obj).val()) == ""  || $(obj).val() == "undefined")
    	{
    		$(".searchBtn > .searchBtnOff").show();
    		$(".searchBtn > .searchBtnOn").hide();
    	}
    	else
    	{
    		$(".searchBtn > .searchBtnOff").hide();
    		$(".searchBtn > .searchBtnOn").show();    		
    	}
    	
    }
	function goToUpload()
	{
		window.location = "/UploadAction.ns";
	}

	function findX(obj)
	  {
		 var curleft = 0;
		    if(obj.offsetParent)
		        while(1)
		        {
		          curleft += obj.offsetLeft;
		          if(!obj.offsetParent)
		            break;
		          obj = obj.offsetParent;
		        }
		    else if(obj.x)
		        curleft += obj.x;
		    return curleft;
	  }
	 function findY(obj)
	  {
	    var curtop = 0;
	    if(obj.offsetParent)
	        while(1)
	        {
	          curtop += obj.offsetTop;
	          if(!obj.offsetParent)
	            break;
	          obj = obj.offsetParent;
	        }
	    else if(obj.y)
	        curtop += obj.y;
	    return curtop;
	  }




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

	 	function ns_createFolder()
	 	{
	 		 ns_SendPostBack('newFolder','');
	 	}

	 	function ns_SendPostBack(eventTarget , eventArgument)
	 	{
	 		var theform;
	 		if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) {
	 			theform = document.forms["FormFlexUpload"];
	 		}
	 		else {
	 			theform = document.FormFlexUpload;
	 		}

	 		theform.ns_EventTarget.value   = eventTarget.split("$").join(":");
	 		theform.ns_EventArgument.value = eventArgument;
	 		alert();
	 		theform.submit();
	 	}



var ns_google_cust_age    = "";
var ns_google_cust_gender = "" ;

function updateGoogleUserVars(){


  var http = getHTTPObject();
   if(http){
     http.open("GET", "/googleuser/", false);
     //http.onreadystatechange = onAge;
	 http.send(null);

	 var txt = http.responseText;
	 if(txt == "unknown")
	   return;

	 var params = new Array();
	 params = txt.split('&');
	 ns_google_cust_gender = params[0].split('=')[1];
	 ns_google_cust_age    = params[1].split('=')[1];
   }
}
updateGoogleUserVars();






function closeLines()
{
	document.getElementById('line').style.display='none';
	setSessionCookieTest ();

}


function setSessionCookieTest () {
	writeSessionCookie('lineC','x');
}

function writeSessionCookie (cookieName, cookieValue) {

	  if (testSessionCookie()) {
	    document.cookie = escape(cookieName) + '=' + escape(cookieValue) + '; path=/';
	    return true;
	  }
	  else return false;
}

function testSessionCookie () {

	  document.cookie ="testSessionCookie=Enabled";

	  if (getCookieValue ('testSessionCookie')=='Enabled')
	    return true
	  else
	    return false;
}

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;
	}


	function limitChars(obj, limit, infodiv)
	{
		var text = $(obj).val(); 
		var textlength = text.length;
		if(textlength > limit)
		{
			if(infodiv)
			{
			 	$('#infodiv' + infodiv ).html('You cannot write more than '+limit+' characters!');
			}
		 	$(obj).val(text.substr(0,limit));
		 	return false;
	 	}
	  	else
	  	{
			if(infodiv)
			{
		 		$('#infodiv' + infodiv ).html((limit - textlength) +' characters left.');
			}
		 	return true;
	 	}

	}