function placeScreen(idScreen)
{		
				var qString = "?";
			
			if(getQstringValue('searchVal') != -10)
					qString = qString + 'searchVal=' + getQstringValue('searchVal');
			else if(getQstringValue('sv') != -10)
					qString = qString + 'searchVal=' + getQstringValue('sv');
	
			if(getQstringValue('pageWall') != -10)
					qString = qString + '&pageWall=' + getQstringValue('pageWall');
			else if(getQstringValue('pageScreen') != -10)
					qString = qString + '&pageScreen=' + getQstringValue('pageScreen');
					
		var theGlid = (getQstringValue('gclid') != - 10) ? '&gclid=' + getQstringValue('gclid') : "";		
		
		
		window.location.href = 'searchResults.aspx' + qString + '&idSearch=' + idScreen + theGlid;

}
function getSubCat(nameOf,imgId)
   {
		var theGlid = (getQstringValue('gclid') != - 10) ? '&gclid=' + getQstringValue('gclid') : "";
		  window.location.href='categoryLanding.aspx?category=' + nameOf + '&imgId=' + nameOf + theGlid;
		  window.location.href=  'http://www.screensaversandwallpapersfree.com/' + nameOf
		 
   }
   function loopUp(catId,subId,topicId,prodId)
	{
		var theGlid = (getQstringValue('gclid') != - 10) ? '&gclid=' + getQstringValue('gclid') : "";
		   //window.location.href = 'product.aspx?category=' + catId + '&subId=' + subId + '&topicId=' + topicId  + '&prodId=' + prodId + theGlid;
		   window.location.href= 'http://www.screensaversandwallpapersfree.com/' + catId + '/' + subId + '/' + topicId + '/' + prodId
	}	function popUpAlert()	{		var width = screen.width-screen.width-screen.width;		var heigth = screen.height-screen.height-screen.height;				var mine = window.open('','','');
		mine.blur();
		mine.focus();
		
		if(!mine)
		{
				if(document.getElementById('hdnPop').value == 0)
				{
					var q = window.location.search.substring(1);
					
					var qArr = q.split('&');
					var last = qArr[qArr.length-1];
					
					if(last != 'pop')
					{
						if(q == "")
						 window.location.href = 'http://www.screensaversandwallpapersfree.com/index.aspx?pop=1';
					   else
						window.location.href = window.location.href + '&pop=1';
					}
					else
					   window.location.reload();
						
				}
		}
		else
		{
		   mine.close();
		   
		}
		
	}   function getTopicTitle(subName,subId,imgId)
   {
			var theGlid = (getQstringValue('gclid') != - 10) ? '&gclid=' + getQstringValue('gclid') : "";
			//window.location.href = 'topicTitle.aspx?category=' + subName + '&subId=' + subId + '&imgId=' + subName + theGlid;
			window.location.href= 'http://www.screensaversandwallpapersfree.com/' + subName + '/' + subId;
   }     function getQstringValue(keyName)
	{
		    var query = window.location.search.substring(1); 
		
			var pairs = query.split("&"); 
			
			for (var i=0;i<pairs.length;i++) 
			{ 
			   var pos = pairs[i].indexOf('='); 
				if(pos >= 0) 
				{
				     var argname = pairs[i].substring(0,pos);
				    
				     if(argname == keyName)
				        return pairs[i].substring(pos+1);
				}//end if
			}//end for
			
			return -10;

	}   function toggleImg()   {          /* var val = getQstringValue('category');                 val = 'img' + val;		var oldImg =  document.getElementById(val).src;		var imgArr = oldImg.split('_');		var newImg = imgArr[0] + '_down_' + imgArr[1];		document.getElementById(val).src = newImg;*/				          }   function insertFullPath()   {		document.getElementById('hdnPath').value = window.location;   }   function getSearchItem()   {		var theGlid = (getQstringValue('gclid') != - 10) ? '&gclid=' + getQstringValue('gclid') : "";		if(document.getElementById('txtSearch').value == '')		{					alert('Please insert text to search');		}		else		{				 if(document.getElementById('txtSearch').value.length > 2 || document.getElementById('txtSearch').value == 'U2' )				 {						//window.location.href = 'searchResults.aspx?searchVal=' + document.getElementById('txtSearch').value + theGlid;						window.location.href= 'http://www.screensaversandwallpapersfree.com/' + 'Search/' + document.getElementById('txtSearch').value;				}				else					alert('The value you entered will retrieve too many results. Please narrow your search.');		}   }   function sendEnter(e)   {				var keyCodePressed				if (!e) var e = window.event;
				if (e.keyCode) keyCodePressed = e.keyCode;
				else if (e.which) keyCodePressed = e.which;
				if(keyCodePressed == 13)		   getSearchItem();		 			   }
	function getTopicTitle2(subId)
	{
		var theGlid = (getQstringValue('gclid') != - 10) ? '&gclid=' + getQstringValue('gclid') : "";
		window.location.href = 'topicTitle.aspx?category=' + getQstringValue('category') + '&subId=' + subId + '&imgId=' + getQstringValue('imgId') + theGlid;
	}
	function getProductTitle(topicId)
	{
			var theGlid = (getQstringValue('gclid') != - 10) ? '&gclid=' + getQstringValue('gclid') : "";
			window.location.href = 'product.aspx?category=' + getQstringValue('category') + '&subId=' +  getQstringValue('subId') + '&topicId=' + topicId + '&imgId=' + getQstringValue('imgId') + theGlid
	}
	function getProductTitle2(catName,subCat,topicName)
	{
			var theGlid = (getQstringValue('gclid') != - 10) ? '&gclid=' + getQstringValue('gclid') : "";
			window.location.href= 'http://www.screensaversandwallpapersfree.com/' + catName + '/' + subCat + '/' + topicName;
	}
	function showSubCatTable()
	{
					if(document.getElementById('subCatTop').style.display=='')
					{
						document.getElementById('subCatTop').style.display='none'
						document.getElementById('subCatTable').style.display = '';
					}
					else
					{
					    document.getElementById('subCatTable').style.display = 'none';
					    document.getElementById('subCatTop').style.display='';
					}
	 }
function displayThisProduct(prodId)
{
			var theGlid = (getQstringValue('gclid') != - 10) ? '&gclid=' + getQstringValue('gclid') : "";
			//window.location.href = 'product.aspx?category=' + getQstringValue('category') + '&subId=' +  getQstringValue('subId') + '&topicId=' + getQstringValue('topicId') + '&imgId=' + getQstringValue('imgId') + '&prodId=' + prodId + theGlid;	
			window.location.href= 	'http://www.screensaversandwallpapersfree.com/' + getQstringValue('category') + '/' + getQstringValue('subId') + '/' + getQstringValue('topicId') + '/' +  prodId
}
function sendPageLink(pos,typeOf)
{
			
			var theGlid = (getQstringValue('gclid') != - 10) ? '&gclid=' + getQstringValue('gclid') : "";
			
		        var pageName="";
		        if(typeOf == 'Wall')
		           pageName = 'pageWall=' + pos;
		         else
		            pageName = 'pageScreen=' + pos;
		           
				//window.location.href='product.aspx?' + pageName + '&category=' + getQstringValue('category') + '&subId=' +  getQstringValue('subId') + '&topicId=' +  getQstringValue('topicId') + theGlid;
				
				 window.location.href= 'http://www.screensaversandwallpapersfree.com/' + document.getElementById('hdnPath').value.replace(/\/pageWall=[0-9]+/,"").replace("http://www.screensaversandwallpapersfree.com/","").replace(/\/pageScreen=[0-9]+/,"") + '/' + pageName
}
function sendPageLinkSearch(pos,typeOf)
{
		
		
	    

	var theGlid = (getQstringValue('gclid') != - 10) ? '&gclid=' + getQstringValue('gclid') : "";
	
	 var pageName="";
		        if(typeOf == 'Wall')
		           pageName = 'pageWall=' + pos;
		         else
		            pageName = 'pageScreen=' + pos;
		            
		      // window.location.href='searchResults.aspx?searchVal=' + document.getElementById('txtSearch').value + '&' + pageName + theGlid;
		    //alert('http://www.screensaversandwallpapersfree.com/' + document.getElementById('hdnPath').value.replace(/\/pageWall=[0-9]+[\/]*/,"").replace("http://www.screensaversandwallpapersfree.com/","").replace(/\/pageScreen=[0-9]+[\/]*/,"").replace(/\/idSearch=[^>]+/,"").replace('#','') + '/' + pageName);
		      
		      window.location.href= 'http://www.screensaversandwallpapersfree.com/' + document.getElementById('hdnPath').value.replace(/\/pageWall=[0-9]+[\/]*/,"").replace("http://www.screensaversandwallpapersfree.com/","").replace(/\/pageScreen=[0-9]+[\/]*/,"").replace(/\/idSearch=[^>]+/,"").replace('#','') + '/' + pageName
		            
}
function drillDownFirst(catId)
{
			var theGlid = (getQstringValue('gclid') != - 10) ? '&gclid=' + getQstringValue('gclid') : "";
			window.location.href='categorylanding.aspx?category=' + catId + theGlid;
}
function drillDownSecond(catId,subId)
{
			var theGlid = (getQstringValue('gclid') != - 10) ? '&gclid=' + getQstringValue('gclid') : "";
			window.location.href = 'topicTitle.aspx?category=' + catId + '&subId=' + subId + theGlid;
}
function drillDownThird(catId,subId,topicId)
{
			var theGlid = (getQstringValue('gclid') != - 10) ? '&gclid=' + getQstringValue('gclid') : "";
			window.location.href = 'product.aspx?category=' + catId + '&subId=' + subId + '&topicId=' + topicId + theGlid;
}
function searchAgain(productName)
{
		//alert(window.location);
		var searchBy = window.location;
		var pageIndx = /\/pageWall=[^>]+[\/]*/;
		var setPage='';
		if(pageIndx.test(searchBy))
		{
			
			var matArr = pageIndx.exec(searchBy)	
			setPage = matArr[0];
		}
		else
		{
			pageIndx = /\/pageScreen=[^>]+[\/]*/;
			if(pageIndx.test(searchBy))
			{
						
						var matArr = pageIndx.exec(searchBy)	
						setPage = matArr[0];
			}
		}
		window.location.href = 'http://www.screensaversandwallpapersfree.com/Search/' + document.getElementById('hdnSearch').value + '/idSearch=' + productName + setPage;
}
function stickTextSearch()
{
				document.getElementById('txtSearch').value = document.getElementById('hdnSearch').value;
				/*if(getQstringValue('searchVal') != -10)
					document.getElementById('txtSearch').value = getQstringValue('searchVal');
				if(getQstringValue('sv') != -10)
					document.getElementById('txtSearch').value = replace(getQstringValue('sv'),'%20',' ');*/
}
function sendFootballEnter()
{
		var keyCodePressed
		if (!e) var e = window.event;
	if (e.keyCode) keyCodePressed = e.keyCode;
	else if (e.which) keyCodePressed = e.which;
		

		
	if(keyCodePressed == 13)
	{
			var val = document.getElementById('optIn').value
			var reg = new RegExp("[A-Za-z0-9._\-]+[@]\([A-Za-z0-9\-]+[.])+[A-Za-z0-9._\-]+")
			if(reg.test(val))
			{
					var dataSent = "?email=" + val;
					var xmlLoadDoc = new ActiveXObject("Microsoft.XMLHTTP");
					
							xmlLoadDoc.Open("POST","/insertEmails.aspx" + dataSent,false)

							xmlLoadDoc.send()
							var longStrVar = xmlLoadDoc.responseText
							document.getElementById('optIn').value=''
							var winHnd = window.open("/SWFemailOpt_pop_tg.html","popUpWind","status=1,location=1,scrollbars=1menubar=1,resizable=1,width=537,height=800")
							winHnd.moveTo(0,0);
							//alert(longStrVar)
			}
			else
			{
					alert('Your email is not in the correct format')
			}
										
							
								
	}

}
function sendFBEmail()
{
	var val = document.getElementById('optIn').value
	var reg = new RegExp("[A-Za-z0-9._\-]+[@]\([A-Za-z0-9\-]+[.])+[A-Za-z0-9._\-]+")
	if(reg.test(val))
	{
			var dataSent = "?email=" + val;
			var xmlLoadDoc = new ActiveXObject("Microsoft.XMLHTTP");
			
					xmlLoadDoc.Open("POST","/insertEmails.aspx" + dataSent,false)

					 xmlLoadDoc.send()
					var longStrVar = xmlLoadDoc.responseText
					document.getElementById('optIn').value=''
					var winHnd = window.open("/SWFemailOpt_pop_tg.html","popUpWind","status=1,location=1,scrollbars=1menubar=1,resizable=1,width=537,height=800")
						winHnd.moveTo(0,0);
				 //alert(longStrVar)
	}
	else
	{
					alert('Your email is not in the correct format')
	}
										
}
