
///////////////////////////////////////
//                                   //
//        Updated: 05-07-2007        //
//             Mini Chat             //
//       FileName: scripts.js        //
//    Written by midnightfun.co.uk   //
//       www.midnightfun.co.uk       //
//            Version 1.9            //
//     License: See license.html     //
//              © 2007               //
//                                   //
///////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////
//                                                                         //
//             Editing is NOT allowed to any of the code below!            //
//                                                                         //
//   If you edit any of the code below this part the script may not work   //
//              and you will be in violation of the licence!               //
//                                                                         //
/////////////////////////////////////////////////////////////////////////////

// Open copyright window.
<!--
function openwindowcopy() {
	window.open ("./help_info/copyright.php","copyright","toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width=300,height=50");
}
//-->

// Open smart reload window.
<!--
function openwindowsmart() {
	window.open ("./help_info/smartrefresh.php","smartrefresh","toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width=570,height=130");
}
//-->

// Open bbcode window.
<!--
function openwindowbb() {
	window.open ("./help_info/bbcode.php","bbcode","toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width=620,height=350");
}
//-->

// Open archive window.
<!--
function openwindowarc() {
	window.open ("./archive.php?page=1","archive","toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,copyhistory=no,width=205,height=650");
}
//-->

// Open users online window.
<!--
function openwindowonline() {
	window.open ("./users_online.php","online","toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width=280,height=150");
}
//-->

// Open last shout window.
<!--
function openwindowlast() {
	window.open ("./help_info/last_shout.php","lastshout","toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width=350,height=100");
}
//-->

// Open last shout window.
<!--
function openwindowcount() {
	window.open ("./help_info/shouts_count.php","shoutcount","toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width=280,height=100");
}
//-->

// Reload the iframe.
<!--
function reload_iframe() {
  var f = getIframeWindowRef('tag');
  f.location.reload()
}
//-->

<!--
function getIframeWindowRef(iframeId) {
  if(document.getElementById && document.getElementById(iframeId) && 
    document.getElementById(iframeId).contentWindow)
      return document.getElementById(iframeId).contentWindow;
  else if(frames && frames[iframeId])
    return frames[iframeId];
  else return null;
}
//-->

// for smilies popup window.
<!--
function smiley(text) {
	text = ' ' + text + ' ';
	if (opener.document.forms['message'].string.createTextRange && opener.document.forms['message'].string.caretPos) {
		var caretPos = opener.document.forms['message'].string.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
		opener.document.forms['post'].string.focus();
	} else {
	opener.document.forms['message'].string.value  += text;
	opener.document.forms['message'].string.focus();
	}
}
//-->

// for main message board window.
<!--
function smiliey(text) {
	var txtarea = document.message.string;
	text = ' ' + text + ' ';
	if (txtarea.createTextRange && txtarea.caretPos) {
		var caretPos = txtarea.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
		txtarea.focus();
	} else {
		txtarea.value  += text;
		txtarea.focus();
	}
}
//-->

// Switch layers on and off.
<!--
function toggleLayer(whichLayer) {
	if (document.getElementById) {
		var style2 = document.getElementById(whichLayer).style;
		style2.display = style2.display? "":"block";
} else if (document.all) {
	var style2 = document.all[whichLayer].style;
	style2.display = style2.display? "":"block";
} else if (document.layers) {
	var style2 = document.layers[whichLayer].style;
	style2.display = style2.display? "":"block";
  }
}
// -->

// Switch themes.
<!--
function getCookie(Name) { 
	var re=new RegExp(Name+"=[^;]+", "i");
	if (document.cookie.match(re)) 
	return document.cookie.match(re)[0].split("=")[1] 
	return null
}

<!--
function setCookie(name, value, days) {
	var expireDate = new Date()
	var expstring=(typeof days!="undefined")? expireDate.setDate(expireDate.getDate()+parseInt(days)) : expireDate.setDate(expireDate.getDate()-5)
	document.cookie = name+"="+value+"; expires="+expireDate.toGMTString()+"; path=/";
}
// -->

<!--
function deleteCookie(name){
	setCookie(name, "moot")
}
// -->

<!--
function setStylesheet(title, randomize){ 
	var i, cacheobj, altsheets=[""]
	for(i=0; (cacheobj=document.getElementsByTagName("link")[i]); i++) {
	if(cacheobj.getAttribute("rel").toLowerCase()=="alternate stylesheet" && cacheobj.getAttribute("title")) { 
	cacheobj.disabled = true
	altsheets.push(cacheobj) 
	if(cacheobj.getAttribute("title") == title) 
	cacheobj.disabled = false 
	}
	}
	if (typeof randomize!="undefined"){ 
	var randomnumber=Math.floor(Math.random()*altsheets.length)
	altsheets[randomnumber].disabled=false
	}
	return (typeof randomize!="undefined" && altsheets[randomnumber]!="")? altsheets[randomnumber].getAttribute("title") : "" 
}
// -->

<!--
function chooseStyle(styletitle, days){ 
	if (document.getElementById){
	setStylesheet(styletitle)
	setCookie("mysheet", styletitle, days)
	}
}
// -->

<!--
function indicateSelected(element){ 
	if (selectedtitle!=null && (element.type==undefined || element.type=="select-one")){ 
	var element=(element.type=="select-one") ? element.options : element
	for (var i=0; i<element.length; i++){
	if (element[i].value==selectedtitle){ 
	if (element[i].tagName=="OPTION") 
	element[i].selected=true
	else 
	element[i].checked=true
	break
	}
	}
	}
}
// -->

var manual_or_random="manual" 
var randomsetting="3 days" 

<!--
if (manual_or_random=="manual"){ 
	var selectedtitle=getCookie("mysheet")
	if (document.getElementById && selectedtitle!=null) 
	setStylesheet(selectedtitle)
	}
	else if (manual_or_random=="random"){ 
	if (randomsetting=="eachtime")
	setStylesheet("", "random")
	else if (randomsetting=="sessiononly"){ 
	if (getCookie("mysheet_s")==null) 
	document.cookie="mysheet_s="+setStylesheet("", "random")+"; path=/" 
	else
	setStylesheet(getCookie("mysheet_s")) 
	}
	else if (randomsetting.search(/^[1-9]+ days/i)!=-1){ 
	if (getCookie("mysheet_r")==null || parseInt(getCookie("mysheet_r_days"))!=parseInt(randomsetting)){ 
	setCookie("mysheet_r", setStylesheet("", "random"), parseInt(randomsetting)) 
	setCookie("mysheet_r_days", randomsetting, parseInt(randomsetting)) 
	}
	else
	setStylesheet(getCookie("mysheet_r")) 
	} 
}
// -->

// Javasript error handling.
<!--
var errorHandler = function(msg, url, linenumber) {
 alert("Error: " + msg + " for " + url + " at " + linenumber);
};
window.onerror = errorHandler;
// -->
