function URLRef(){

		 dPar=document.URL.substring(document.URL.indexOf("?s=")+3, document.URL.length)
		 if (document.URL.indexOf("?s=")==-1) {
		 dPar=""
		 }
 		 return dPar;
}

function LoadRef() {
	var yourref = getCookie("Ref"); 
	if (yourref != null){
   	}
	else{
		yourref=URLRef();
	 	register(yourref, "Ref");	   
	 }  

}

function GetRef() {
	var yourref = getCookie("Ref");
	return yourref;
}




function setCookie(name, value, expire) {
		  document.cookie = name + "=" + escape(value) + "; expires=" + expire.toGMTString() + "; path=" + "/"
	  
}

function register(CookieVal, CookieName) { 
          var today = new Date();
          var expires = new Date();
          expires.setTime(today.getTime() + 7 *24 * 60 * 60 * 1000);
		  setCookie(CookieName, CookieVal, expires);
}

function getCookie(Name) {
          var search = Name + "=";
          if (document.cookie.length > 0) { 
                    offset = document.cookie.indexOf(search);
                    if (offset != -1) { // if cookie exists 
                              offset += search.length;
                              end = document.cookie.indexOf(";", offset);
                              if (end == -1){
                                        end = document.cookie.length;
									}									
                              return unescape(document.cookie.substring(offset, end));
							  
                    } 
          }
}

