// JavaScript Document/*************************************************************** * * Grabs the cookie and returns its value. * * @param offset - Where to start looking for the value * **************************************************************/function getCookieVal (offset) {	var endstr = document.cookie.indexOf (";", offset);	if (endstr == -1) {   		endstr = document.cookie.length;   	}  	return unescape(document.cookie.substring(offset, endstr));}/*************************************************************** * * Gets the cookie by name * * @param name - The name of the cookie * * @return null * **************************************************************/function GetCookie (name) {  	var arg = name + "=";  	var alen = arg.length;  	var clen = document.cookie.length;  	var i = 0;  	while (i < clen) {    	var j = i + alen;    	if (document.cookie.substring(i, j) == arg) {      		return getCookieVal (j);      	}    	i = document.cookie.indexOf(" ", i) + 1;    	if (i == 0) break;     }  	return null;}/*************************************************************** * * Sets the variable memberLoggedIn to true if the cookie * 'MemberIsLoggedIn' value is true * **************************************************************/var memberLoggedIn = false;if( GetCookie('MemberIsLoggedIn') == "true" ) {	memberLoggedIn = true;}// Base URL pathvar base = "https://dev.emmastine.com/PopUps";// Set the log in window pathvar logInWindow = base+"/MemberLogIn.php";//var logInWindow = "http://localhost/~richard/svn/EmmaStine.com/PopUps/MemberLogIn.php";var logInWindo = "http://dev.emmastine.com/PopUps/MemberLogIn.php";// Set the affiliate log in window pathvar aflogInWindow = base+"/AFMemberLogIn.php";var afLogInWindow = "http://localhost/~richard/svn/EmmaStine.com/Fashion-Jewelry-Bracelets.php";function getUrlVars() {    var vars = {};    var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {        vars[key] = value;    });    return vars;}/*************************************************************** * * Refreshes the page  * **************************************************************/function refreshMyself() {	var newURL = window.location.protocol + "//" + window.location.host + window.location.pathname;	//alert(newURL);	//window.location = newURL;	//alert(getUrlVars()["pid"]);	//alert(getUrlVars()["page"]);	//alert(getUrlVars()["nav"]);		var param = false;		if( getUrlVars()["pid"] != undefined ) {		newURL += "?pid="+getUrlVars()["pid"];		param = true;	}	if( getUrlVars()["page"] != undefined ) {		if(!param) {			newURL += "?page="+getUrlVars()["page"];			param = true		} else {			newURL += "&page="+getUrlVars()["page"];		}			}	if( getUrlVars()["nav"] != undefined ) {		if(!param) {			newURL += "?nav="+getUrlVars()["nav"];			param = true		} else {			newURL += "&nav="+getUrlVars()["nav"];		}	}	//alert(newURL);	window.location = newURL;	//window.location = window.location.href;}/*************************************************************** * * Calls the VIP Log In pop up. If the calling 'page' is * an Affiliate landing page calls the Affiliate specific * log in pop up. * * @param page Optional, value must be 'af' if being called * 				from Affiliate Landing Page  * * @deprecated  **************************************************************/function signMeUp(page) {	var caller = page;		if( caller === 'af' ) {		Mediabox.open('../PopUps/AFMemberLogin.php', '', '400 500');	} else {		Mediabox.open('../vip-log-in2.php', '', '400 500');	}		}/*************************************************************** * * Calls the Member Log In pop up. If the calling 'page' is * an Affiliate landing page calls the Affiliate specific * log in pop up. * * @param page Optional, value must be 'af' if being called * 				from Affiliate Landing Page  * * @deprecated  **************************************************************/function memberLogIn(page) {	var caller = page;	if( caller === 'af' ) {		Mediabox.open(afLogInWindow, '', '400 500');	} else {		if( caller === 'inner' ) {			Mediabox.open('../PopUps/MemberLogIn.php', '', '400 500');		} else {			Mediabox.open('PopUps/MemberLogIn.php', '', '400 500');		}			}		}
