function gup1( name ){  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");  var regexS = "[\\?&]"+name+"=([^&#]*)";  var regex = new RegExp( regexS );  var results = regex.exec( window.location.href );  if( results == null )    return "";  else    return results[1];}

$(document).ready(function(){

	if (location.href.indexOf('tip.html?productid=') != -1){
	
	}else if (location.href.indexOf('tip.html') != -1){
		$('body').html('<div class="TipText">E-mailen er nu afsendt<br><br>du kan nu lukke denne popup</div>');
	}

	$('#ShopMainLayOutTable #Tip').attr('href','/shop/tip.html?productid='+ ProductNumber +'&VariantIdSelected=0&hideinterface=1')

	$('#ShopMainLayOutTable #askfortheproduct').attr('href','/shop/cms-spoerg-om-varen.html?hideinterface=1&prodnr='+ ProductNumber)
	
	if($('#prodnr').length != 0){
		$('#prodnr').val("http://milker.dk/shop/search-1.html?keyword=" + gup1('prodnr'))
	}
	
});

function findreplace(el, find, rep)		{try{$(el).html($(el).html().replace(find, rep))}catch(e){};}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
	{
	c_start=c_start + c_name.length+1;
	c_end=document.cookie.indexOf(";",c_start);
	if (c_end==-1) c_end=document.cookie.length;
	return unescape(document.cookie.substring(c_start,c_end));
	}
  }
return "";
}

function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

