function confirmThreadDel(thread_id,forum_id) {
	isok = confirm("Are you sure you want to delete this thread and all posts within it?");
	if (isok) {
		new_url = "/forums/forum.cfm?action=del_thread&forum_id="+forum_id+"&thread_id="+thread_id;
		self.location=new_url;
	}
}

function confirmDelPost(comment_id,forum_id,class_id,editorial_id,playlist_id,thread_id) {
	isok = confirm("Are you sure you want to delete this post?");
	if (isok) {
		self.location = "/forums/forum.cfm?forum_id="+forum_id+"&class_id="+class_id+"&editorial_id="+editorial_id+"&playlist_id="+playlist_id+"&thread_id="+thread_id+"&action=delete_post&comment_id="+comment_id;
	}
}

function checkData() {
	result = true;
	error_mess = "";
	num_errors = 0;
	if (document.newmess_form.comment.value.length > 1000) {
		result = false;
		num_errors = num_errors + 1;
		error_mess = error_mess + num_errors + ") Your comment is too long. The maximum length is 1000 characters, the current length is "+document.newmess_form.comment.value.length+" characters. If you have an especially long comment to post, you can seperate it into two or more posts if you wish.\n\n";
	}
	if (document.newmess_form.subject) {
		if (document.newmess_form.subject.value == "") {
			result = false;
			num_errors = num_errors + 1;
			error_mess = error_mess + num_errors + ") You need to enter a subject.\n\n";
		}
	}
	if (document.newmess_form.comment.value == "") {
		result = false;
		num_errors = num_errors + 1;
		error_mess = error_mess + num_errors + ") You need to enter a comment.\n\n";
	}
	if (!result) {
		alert("Sorry, can't do that right now because:\n\n"+error_mess);
	}
	return result;
}

function AddText(NewCode){document.newmess_form.comment.value+=NewCode}
function hyperlink(){
	txt2=prompt("Text to be shown for the link.","");
	if(txt2!=null){
		txt=prompt("URL for the link.","http://");
		if(txt.indexOf("http") < 0){
			txt=prompt("URL must contain 'http'. Please re-type URL.",txt);
		}
		if(txt.indexOf("http") < 0){
			alert("Link not added. URL did not contain 'http'.");
		}
		else {
			if(txt2==""){
				AddTxt="[url="+txt+"]"+txt+"[/url]";
				AddText(AddTxt);
			}
			else{
				AddTxt="[url="+txt+"]"+txt2+"[/url]";
				AddText(AddTxt);
			}
		}
	}
}

function image(){
var URL = 'photo_upload.asp';

    var windowName = 'photo_upload';

    var features =
        'width=650' +
        ',height=450' +
        ',location=no' +
        ',menubar=no' +
        ',scrollbars=yes' +
        ',status=no' +
        ',toolbar=no' +
        ',resizable=no,top=10,left=10';

    window.open (URL, windowName, features);

}

function spoiler(){alert("Please place spoiler text between the [spoiler][/spoiler] tags (these will be inserted)");AddText("[spoiler]SpoilerText[/spoiler]");}

function showSpoiler(my_sp_name,my_sp_name2) {
	document.getElementById(my_sp_name2).style.display = 'none';
	document.getElementById(my_sp_name).style.display = 'block';
}

function big_photo(which_photo,width,height) {	
	var URL = '/bigphoto.asp?desc=Photo&file_path=' + which_photo;

    var windowName = 'yt_photo'

    var features =
        'width='        + width +
        ',height='      + height +
        ',location=no' +
        ',menubar=no' +
        ',scrollbars=auto' +
        ',status=no' +
        ',toolbar=no' +
        ',resizable=no,top=10,left=10';

    window.open (URL, windowName, features);
}

function quoteMe(handle,comment,mydate) {
	document.newmess_form.comment.value = "[quote]On " + mydate + " " + handle + " wrote: " + comment + "[/quote]\n" +  document.newmess_form.comment.value;
	document.newmess_form.comment.focus();
}

function quoteMe2(comment) {
	document.newmess_form.comment.value = comment + "\n" +  document.newmess_form.comment.value;
	document.newmess_form.comment.focus();
}

function imageBox() {
	loader_frame.location="/functions/upload_image.cfm?image_type=forum";
	showLoader(1);
}
function smileHelp() {
	loader_frame.location="/forums/smile_help.cfm";
	showLoader(1);
}



function showLoader(show){
 if(show){ 
	 ds = 'block'; 
	if (BrowserDetect.browser == "Explorer" && BrowserDetect.version <= 6) {
		my_win_width = 400;
		my_win_height = 300;
		my_left = (document.documentElement.clientWidth / 2) - (my_win_width / 2);
		new_my_left = round_decimals(my_left,0)
		
		my_top = (document.documentElement.clientHeight / 2) - (my_win_height / 2);
		new_my_top = round_decimals(my_top,0)
		my_scroll_top = round_decimals(document.documentElement.scrollTop,0)
		new_my_top2 = (new_my_top*1) + (my_scroll_top*1);
		document.getElementById('loader').style.position = "absolute";
		document.getElementById('loader').style.left = new_my_left;
		document.getElementById('loader').style.marginLeft = 0;
		document.getElementById('loader').style.top = new_my_top2;
		document.getElementById('loader').style.marginTop = 0;
	}
 }
 else{ 
	 ds = 'none'; 
 }
 document.getElementById('loader_bg').style.display = ds;
 document.getElementById('loader').style.display = ds;
  if(!show) {
	frames['loader_frame'].location.href = "/layout/blank.html";
 }
 }
 var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();
