// MPJS
// includes KEY functions!
function viewImage(path){
	viewer = window.open('about:blank','ImageViewer',"fullscreen = true");
	viewer.document.write('<body bgcolor="#151515"><center><img src="'+path+'" onmousedown="window.close();" /></body>');
	viewer.window.focus();
}
String.prototype.defined = function(){
	if ( typeof(this) == "undefined" ) {
		return false;
	} else {
		return true;
	}
}
function getQueryParams(){
	loc = unescape(self.location.href).toLowerCase();
	prms_t = loc.split('?')[1];
	prms_t = prms_t.split('<params>')[1];
	prms_t = prms_t.split('</params>')[0];
	return prms_t;
}
function relocateLink(path){
	loc = unescape(self.location.href);
	prms_t = loc.split('?')[1];
	window.location = path+"?"+prms_t;
}
function cssChange(xpath){
	//Old mode!
	/*
	prms = getQueryParams();
	ccss = prms.split('<ccss>')[1].split('</ccss>')[0].split(':');
	if(ccss[0] == 'true'){
		if(ccss[1] != 'regular'){
			css = document.getElementsByTagName("link")[0];
			css.href = xpath+"CSS/StyleSheets/Color/"+ccss[1]+".css";
		}
	}*/
	ccssFAR(xpath);
}
function jsremoveclassobjects(xpath,index){
	css = document.getElementsByTagName("link")[index];
	css.href = xpath+"CSS/StyleSheets/htmllinks.css";
}
function writeToOO(){
	document.getElementById("OtherObjects").innerHTML = "<h1>Contact Wolflink289 option available!</h1><span id='contact'><a href='http://www.wolflink289.com/Contact/'>Contact Wolflink289</a> or <a href='http://www.wolflink289.com/Contact/track'>Track a Response</a></span>";
}
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) {
	bfc = getCookie(c_name);
	if (typeof(expiredays) == "number"){
		var exdate = new Date();
		exdate.setDate(exdate.getDate()+expiredays);
		expire = "; expires="+exdate.toGMTString()+"; path=/";
	} else {
		expire = "; path=/";	
	}
	document.cookie = c_name+"="+escape(value)+expire;
	if (bfc == getCookie(c_name)){
		return false;
	} else {
		return true;
	}
}
function ccssFAR(xpath){	
	cs = getCookie('ccss');
	if ((cs.defined() == true) && (cs!='')) {
		css = document.getElementsByTagName("link")[0];
		css.href = "http://www.wolflink289.com/CSS/StyleSheets/Color/"+cs+".css";
	} else {
		setCookie('ccss',"regular",365);
	}
}