// Title: ZebraNights Header JavaScripts
// URL: http://www.zebranights.com
// Version: 9.10.22
showScriptVersion = function() {
	var yourstate=window.alert("zNights Script Engine Version\n\nzNights is currently running v9.10.22");
};
showScriptVersion2 = function() {
	document.write("v9.10.22");
};
hidestatus = function(){
	window.status='';
	return true;
};
if (document.layers) {
	document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT | Event.MOUSEMOVE);
	document.onmouseover=hidestatus;
	document.onmouseout=hidestatus;
}

confirmit = function(url) {
	var yourstate=window.confirm("NOTE!!!\n\nYou are about to view Explicit Adult content\n\nClick OK to continue");
	if (yourstate){znpagefetcher.load('gallerybody', url, true, '', '');}
};
confirmit2 = function(url) {
	var yourstate=window.confirm("NOTE!!!\n\nYou are about to view Explicit Adult content\n\nClick OK to continue");
	if (yourstate){top.document.getElementById('main_body').src=url;}
};
confirmdelete = function(znurl,znframe) {
	var yourstate=window.confirm("NOTE!!!\n\nYou are about to delete this item\n\nClick OK to continue");
	if (yourstate) {document.getElementById(znframe).src=znurl;}
};
requestalbum = function(url) {
	document.getElementById('albumaccess').innerHTML='';
	var yourstate=window.confirm("Make sure that you have contacted this Profile before\nrequesting to see the Album, OR at the very least,\nmake sure you have READ the Profile.\n\nDo you want to Request access to this Private Album?\n\nClick OK to continue");
	if (yourstate) {document.getElementById('detailsframe').src=url;}
};
requestvideos = function(url) {
	document.getElementById('videosaccess').innerHTML='';
	var yourstate=window.confirm("Make sure that you have contacted this Profile before\nrequesting to see their Private Videos, OR at the very least,\nmake sure you have READ the Profile.\n\nDo you want to Request access to these Private Videos?\n\nClick OK to continue");
	if (yourstate) {document.getElementById('detailsframe').src=url;}
};
timeout = function(nick) {
	var yourstate=window.alert("TIMEOUT!!!\n\nAt some point you have offended a zNights member which has caused them to give you a TimeOut.\n\nThis TimeOut will expire automatically.\n\nThis means that while the TimeOut is in effect, you can not contact them at all.");
};
timeout_msg = function(nick,expire) {
	var yourstate=window.alert("TIMEOUT!!!\n\nAt some point you have offended '" + nick + "' which has caused them to give you a TimeOut.\n\nThis TimeOut will expire automatically on: " + expire + ".\n\nThis means that while the TimeOut is in effect, you can not contact them at all.");
};
noticeit = function(msg) {
	var yourstate=window.alert(msg);
};
znModalNotice = function(caption,msg) {
	msg += "<br><br><br><p align='center'><input type='button' class='simplemodal-close button' value=' Close '></p><br>";
	$.modal("<TABLE WIDTH='100%' align='center' BORDER='0' CELLSPACING='1' CELLPADDING='6'><TR><td class='fcaption'>" + caption + "</td></TR></TABLE><br><TABLE WIDTH='100%' align='center' BORDER='0' CELLSPACING='10' CELLPADDING='6'><TR><td>" + msg + "</td></TR></TABLE>", {close:false});
};
znModalNotice2 = function(msg) {
	msg += "<br><br><br><p align='center'><input type='button' class='simplemodal-close button' value=' Close '></p><br>";
	$.modal("<TABLE WIDTH='100%' align='center' BORDER='0' CELLSPACING='1' CELLPADDING='6'><TR><td class='fcaption'><b>NOTICE!</b></td></TR></TABLE><br><TABLE WIDTH='100%' align='center' BORDER='0' CELLSPACING='10' CELLPADDING='6'><TR><td>" + msg + "</td></TR></TABLE>", {close:false});
};
gold_notice = function() {
	var yourstate=window.confirm("PROFILE NOT COMPLETE!\n\nYou need to complete your Profile to access this part of zNights.\n\nPlease goto `Members/Account/Profile`");
	if (yourstate) {top.frames[1].location.href='/pim/account';}
};
vip_notice = function() {
	msg = "You need to be a VIP subscriber in order to access this part of zNights.";
	msg += "<br><br><br><p align='center'><a href='/subscribe' target='main_body'><b>Click Here to Subscribe</b></a></p>";
	msg += "<br><br><p align='center'><input type='button' class='simplemodal-close button' value=' Close '></p><br>";
	$.modal("<TABLE WIDTH='100%' align='center' BORDER='0' CELLSPACING='1' CELLPADDING='6'><TR><td class='fcaption'><b>ACCESS RESTRICTED!!</b></td></TR></TABLE><br><TABLE WIDTH='100%' align='center' BORDER='0' CELLSPACING='10' CELLPADDING='6'><TR><td>" + msg + "</td></TR></TABLE>", {close:false});
};
vip_notice2 = function() {
	var yourstate=window.confirm("ACCESS RESTRICTED!\n\nYou need to be a VIP subscriber in order to access this part of zNights.\n\nClick OK to go to `Subscribe`");
	if (yourstate) {top.frames[1].location.href='/subscribe';}
};
events_notice = function() {
	msg = "You need to be a Club/Organiser or Event Partner in order to access this part of zNights.";
	msg += "<br><br><br><p align='center'><a class='simplemodal-close' href='#' onclick='javascript:znpagefetcher.load(\"interactbody\", \"/pim/interact/events_apply.php\", true, \"\", \"\");updateIT(\"label\",\"My Interactions: Events\");setTabs(\"interact\",\"4\");'><b>Click Here to Apply</b></a></p>";
	msg += "<br><br><p align='center'><input type='button' class='simplemodal-close button' value=' Close '></p><br>";
	$.modal("<TABLE WIDTH='100%' align='center' BORDER='0' CELLSPACING='1' CELLPADDING='6'><TR><td class='fcaption'><b>ACCESS RESTRICTED!!</b></td></TR></TABLE><br><TABLE WIDTH='100%' align='center' BORDER='0' CELLSPACING='10' CELLPADDING='6'><TR><td>" + msg + "</td></TR></TABLE>", {close:false});
};
launchpopupscroll = function(url, name, width, height,scroll) {
   winSet = "toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes,resizable=yes,status=no";
   winSet += ",width="+width +",height="+height+",left="+(screen.availWidth-width)/2+",top="+(screen.availHeight-height)/2;
   mypopwnd = window.open(url, name, winSet);
};
launchpopup = function(url, name, width, height) {
   launchpopupscroll(url, name, width, height,"yes");
};
commspopup = function(mode,submode){
	newwindow = window.open('/comms/index.php?comms_mode='+mode+'&comms_sub='+submode,'comms','width=805,height=545,toolbar=no,menubar=no,directories=no,location=no,scrollbars=yes,status=no,resizable=no,fullscreen=no');
	newwindow.focus();
};
if(document.getElementById&&!document.all){ns6=1;}else{ns6=0;}
var agtbrw=navigator.userAgent.toLowerCase();
var operaaa=(agtbrw.indexOf('opera')!=-1);
var head="display:''";
var folder='';
var zn_dupCounter = 1;
expandit = function(curobj){
	if(document.getElementById(curobj)){
		folder=document.getElementById(curobj).style;
	}else{
		if(ns6==1||operaaa===true){
			folder=curobj.nextSibling.nextSibling.style;
		}else{
			folder=document.all[curobj.sourceIndex+1].style;
		}
	}
	if (folder.display=="none"){folder.display="";}else{folder.display="none";}
};
expandit2 = function(curobj, hide) {
	if(document.getElementById(curobj)) {
  		folder=document.getElementById(curobj).style;
	} else {
		if(ns6==1||operaaa===true) {
			folder=curobj.nextSibling.nextSibling.style;
		} else {
			folder=document.all[curobj.sourceIndex+1].style;
		}
   }
	if(folder.display=="none") {
		folder.display="";
	} else {
		folder.display="none";
	}
	if(hide) {
		var hide_objects = hide.split(",");
		for(i=0; i<hide_objects.length; i++) {
			hide_objects[i]=hide_objects[i].replace(/^\s*(.*)/, "$1");
			hide_objects[i]=hide_objects[i].replace(/(.*?)\s*$/, "$1");
			if(document.getElementById(hide_objects[i])) {
				hidden=document.getElementById(hide_objects[i]).style;
				if(hidden.display==="") {
					hidden.display="none";
				}
			}
		}
	}
};
expanditPlay = function(curobj){
	if(curobj=="span_flirts") {
		document.getElementById("span_smiles").style.display="none";
		document.getElementById("span_pokes").style.display="none";
	}
	if(curobj=="span_smiles") {
		document.getElementById("span_flirts").style.display="none";
		document.getElementById("span_pokes").style.display="none";
	}
	if(curobj=="span_pokes") {
		document.getElementById("span_flirts").style.display="none";
		document.getElementById("span_smiles").style.display="none";
	}
	if(document.getElementById(curobj)){
		folder=document.getElementById(curobj).style;
	}else{
		if(ns6==1||operaaa===true){
			folder=curobj.nextSibling.nextSibling.style;
		}else{
			folder=document.all[curobj.sourceIndex+1].style;
		}
	}
	if (folder.display=="none"){folder.display="";}else{folder.display="none";}
};
loadstatussubs = function(){
	parent.main_body.location='/subscribe/subs_decide.php';
};
mOut = function(src, colour){
	src.style.backgroundColor = colour;
};
mFlip = function(control){
	if(document.getElementById(control)){
		oControl=document.getElementById(control).style;
	}else{
		if(ns6==1||operaaa===true){
			oControl=control.nextSibling.nextSibling.style;
			
		}else{
			oControl=document.all[control.sourceIndex+1].style;
		}
	}
	oText=document.getElementById([control + "T"]);
	if (oControl.display == "none"){
		oControl.display = "";
		oText.innerHTML = "Hide Item";
	}else{
		oControl.display = "none";
		oText.innerHTML = "Show Item";
	}
};
mOver = function(src, colour){ 
	src.style.cursor = 'hand';
	src.style.backgroundColor = colour;
};
mClick = function(src){
	if(event.srcElement.tagName=='TD'){
		src.children.tags('A')[0].click();
	}
};
updateIT = function(src, msg){
	oText=document.getElementById(src);
	oText.innerHTML = msg;
};
duplicateHTML = function(copy,paste,baseid){
	if(document.getElementById(copy)){
		zn_dupCounter++;
		var type = document.getElementById(copy).nodeName; // get the tag name of the source copy.
		var but = document.createElement('input');
		var br = document.createElement('br');
		but.type = 'button';
		but.value = 'x';
		but.className = 'button';
		but.onclick = function(){ this.parentNode.parentNode.removeChild(this.parentNode); };
		var destination = document.getElementById(paste);
		var source      = document.getElementById(copy).cloneNode(true);
		var newentry = document.createElement(type);
		newentry.appendChild(source);
		newentry.value='';
		newentry.appendChild(but);
		newentry.appendChild(br);
		if(baseid) {
			newid = baseid+zn_dupCounter;
			newentry.innerHTML = newentry.innerHTML.replace(new RegExp(baseid, 'g'), newid);
			newentry.id=newid;
		}
		destination.appendChild(newentry);
	}
};
