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();

//alert(BrowserDetect.browser+ " "+BrowserDetect.version);

function replaceText(my_field)
{
	my_field.value = my_field.value.replace(/</g,"&lt;");
	my_field.value = my_field.value.replace(/>/g,"&gt;");
	if (my_field.value.indexOf("--") > 0) {
	my_field.value = my_field.value.replace(/--/g,"- - ");
	my_field.value = my_field.value.replace(/--/g,"- - ");
	my_field.value = my_field.value.replace(/--/g,"- - ");
	}
	return true;
}

function addBookmark(title,url) {
if (window.sidebar) { 
window.sidebar.addPanel(title, url,""); 
} else if( document.all ) {
window.external.AddFavorite( url, title);
} else if( window.opera && window.print ) {
return true;
}
}

function round_decimals(original_number, decimals) {
    var result1 = original_number * Math.pow(10, decimals)
    var result2 = Math.round(result1)
    var result3 = result2 / Math.pow(10, decimals)
    return pad_with_zeros(result3, decimals)
}

function nothing() {
		window.status = "Click to Enlarge";
}

function pad_with_zeros(rounded_value, decimal_places) {

    // Convert the number to a string
    var value_string = rounded_value.toString()
    
    // Locate the decimal point
    var decimal_location = value_string.indexOf(".")

    // Is there a decimal point?
    if (decimal_location == -1) {
        
        // If no, then all decimal places will be padded with 0s
        decimal_part_length = 0
        
        // If decimal_places is greater than zero, tack on a decimal point
        value_string += decimal_places > 0 ? "." : ""
    }
    else {

        // If yes, then only the extra decimal places will be padded with 0s
        decimal_part_length = value_string.length - decimal_location - 1
    }
    
    // Calculate the number of decimal places that need to be padded with 0s
    var pad_total = decimal_places - decimal_part_length
    
    if (pad_total > 0) {
        
        // Pad the string with 0s
        for (var counter = 1; counter <= pad_total; counter++) 
            value_string += "0"
        }
    return value_string
}

function sBoxClear() {
	my_value = document.search_form.ss.value;
	if (my_value == "Search") {
		document.search_form.ss.value = "";
	}
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function land(ref, target)
{
lowtarget=target.toLowerCase();
if (lowtarget=="_self") {window.location=loc;}
else {if (lowtarget=="_top") {top.location=loc;}
else {if (lowtarget=="_blank") {window.open(loc);}
else {if (lowtarget=="_parent") {parent.location=loc;}
else {parent.frames[target].location=loc;};
}}}
}
function jump(menu)
{
ref=menu.choice.options[menu.choice.selectedIndex].value;
splitc=ref.lastIndexOf("*");
target="";
if (splitc!=-1)
{loc=ref.substring(0,splitc);
target=ref.substring(splitc+1,1000);}
else {loc=ref; target="_self";};
if (ref != "") {land(loc,target);}
}

function popUp(URL,windowName,width,height) {	
    var features =
        'width='        + width +
        ',height='      + height +
        ',location=no' +
        ',menubar=no' +
        ',scrollbars=no' +
        ',status=no' +
        ',toolbar=no' +
        ',resizable=yes,top=10,left=10';

    window.open (URL, windowName, features);
}

function update(limit,cur_val) {
   var old = document.newmess_form.counter.value;
   document.newmess_form.counter.value=cur_val;
   if(document.newmess_form.counter.value > limit && old <= limit) {
     alert('Your comment is too long! '+limit+' chars max.');
     if(document.styleSheets) {
       document.newmess_form.counter.style.fontWeight = 'bold';
       document.newmess_form.counter.style.color = '#ff0000'; } }
   else if(document.newmess_form.counter.value <= limit && old > limit
	   && document.styleSheets ) {
       document.newmess_form.counter.style.fontWeight = 'normal';
       document.newmess_form.counter.style.color = '#000000'; } 
   }

function update2(limit,field_name,counter_name) {
   //my_form = getElementById(form_name);
   my_field = document.getElementById(field_name);
   cur_val = my_field.value.length;
   my_counter = document.getElementById(counter_name);
   var old = my_counter.value;
   my_counter.value=cur_val;
   if(my_counter.value > limit && old <= limit) {
     alert('Your comment is too long! '+limit+' chars max.');
     if(document.styleSheets) {
       my_counter.style.fontWeight = 'bold';
       my_counter.style.color = '#ff0000'; } }
   else if(my_counter.value <= limit && old > limit
	   && document.styleSheets ) {
       my_counter.style.fontWeight = 'normal';
       my_counter.style.color = '#000000'; } 
   }

function showHelp(my_id) {
		document.getElementById(my_id).style.display='block';
	}

// this fixes an issue with the old method, ambiguous values 
// with this test document.cookie.indexOf( name + "=" );
function Get_Cookie( check_name ) {
	// first we'll split this cookie up into name/value pairs
	// note: document.cookie only returns name=value, not the other components
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false; // set boolean t/f default f
	
	for ( i = 0; i < a_all_cookies.length; i++ )
	{
		// now we'll split apart each name=value pair
		a_temp_cookie = a_all_cookies[i].split( '=' );
		
		
		// and trim left/right whitespace while we're at it
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
	
		// if the extracted name matches passed check_name
		if ( cookie_name == check_name )
		{
			b_cookie_found = true;
			// we need to handle case where cookie has no value but exists (no = sign, that is):
			if ( a_temp_cookie.length > 1 )
			{
				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			}
			// note that in cases where cookie is initialized but no value, null is returned
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found )
	{
		return null;
	}
}		

function Delete_Cookie( name, path, domain ) {
if ( Get_Cookie( name ) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function getCookieVal (offset) {  
var endstr = document.cookie.indexOf (";", offset);  
if (endstr == -1)    
endstr = document.cookie.length;  
return unescape(document.cookie.substring(offset, endstr));
}
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;
}



function loginBar() {
	my_handle = GetCookie('YTHANDLE');
	ytk = GetCookie('YTINFO');
	
	//document.write("mh: " + my_handle + " " + "mh: " + ytk + " ");
	
	//alert(ytk);
	if (my_handle && ytk) {
		
		
			my_handle_nice = my_handle.replace(' ','+');
			document.write("Hi, <b>" + my_handle + "</b>! <a target=_top class='copy_login_link' href='/" + my_handle_nice + "'><B>My Profile</B></a> | <a target=_top class='copy_login_link' href='/activity.cfm'><B>My Subscriptions</B></a> | <nobr><a target=_top class='copy_login_link' href=log_out.cfm>Log Out</a></a></nobr>");
			//document.write("Hi, <b>" + my_handle + "</b>! <nobr><a class='copy_login_link' href=log_out.cfm><B>Log Out</B></a></a></nobr>");
		
		
	}
	else {
		document.write("<nobr><a target=_top class='copy_login_link' href=log_in.cfm><B>Log In</B></a> | <a target=_top class='copy_login_link' href=new_acc.cfm><B>New Account</B></a></nobr>");
	}
}

function check_search() {
	result = true;
	if (document.s_form.ss.value.length < 2) {
		alert("Please enter a string to search for");
		result = false;
	}
	return result;
}

function keyOnly() {	
    is_ok = confirm("This function tracks new posts since the last time you looked at the thread, and will jump you directly to the first new post in the thread. You need to be a key member in order for this to work.\n\nWant to become one now?");
	if (is_ok) {
		self.location="/gen/key_members.asp";
	}
}

function delConfirm(obj_name,my_url) {	
    is_ok = confirm("Are you sure you want to delete this "+obj_name+"?");
	if (is_ok) {
		self.location=my_url;
	}
}

function delPost(my_reply,comment_id,ct,thisq,read_page,ss,my_k,sw) {	
    if (my_reply == 0) {
		is_ok = confirm("Are you sure you want to delete this ENTIRE THREAD? Deleting the first post will delete this entire thread and make it inaccessable.");
	}
	else {
		is_ok = confirm("Are you sure you want to delete this post?");
	}
	if (is_ok) {		self.location="forums.asp?action=delete&cid="+comment_id+"&ct="+ct+"&q_id="+thisq+"&read_page="+read_page+"&ss="+ss+"&k="+my_k+"&search_where="+sw;
	}
}

function delPostArch(my_reply,comment_id,ct,thisq,read_page,ss,my_k,sw) {	
    if (my_reply == 0) {
		is_ok = confirm("Are you sure you want to delete this ENTIRE THREAD? Deleting the first post will delete this entire thread and make it inaccessable.");
	}
	else {
		is_ok = confirm("Are you sure you want to delete this post?");
	}
	if (is_ok) {		self.location="forums.asp?action=delete_arch&cid="+comment_id+"&ct="+ct+"&q_id="+thisq+"&read_page="+read_page+"&ss="+ss+"&k="+my_k+"&search_where="+sw;
	}
}

function lockThread(comment_id,ct,thisq,read_page,ss,my_k,sw) {	
	lock_reason = confirm("Are you sure you want to lock this thread?");
	if (lock_reason) {		self.location="forums.asp?action=lock&cid="+comment_id+"&ct="+ct+"&q_id="+thisq+"&read_page="+read_page+"&ss="+ss+"&k="+my_k+"&search_where="+sw;
	}
}
function unlockThread(comment_id,ct,thisq,read_page,ss,my_k,sw) {	
	lock_reason = confirm("Are you sure you want to unlock this thread?");
	if (lock_reason) {		self.location="forums.asp?action=unlock&cid="+comment_id+"&ct="+ct+"&q_id="+thisq+"&read_page="+read_page+"&ss="+ss+"&k="+my_k+"&search_where="+sw;
	}
}



function updateCounter(limit,cur_val,counter_name) {
	var old = document.getElementById(counter_name).value;
	document.getElementById(counter_name).value=cur_val;
	if(document.getElementById(counter_name).value > limit && old <= limit) {
		alert('Text is too long! '+limit+' chars max.');
	if(document.styleSheets) {
		document.getElementById(counter_name).style.fontWeight = 'bold';
		document.getElementById(counter_name).style.color = '#ff0000'; } }
	else if(document.getElementById(counter_name).value <= limit && old > limit
	   && document.styleSheets ) {
		document.getElementById(counter_name).style.fontWeight = 'normal';
		document.getElementById(counter_name).style.color = '#000000'; } 
}

function keyOnly() {	
    is_ok = confirm("You need to be a key member in order to use this feature.\n\nIf you click OK you will be taken to a page with more information.");
	if (is_ok) {
		self.location="/gen/key_members.asp";
	}
}

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!=null){if(txt2==""){AddTxt="[url]"+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 StyleSheetChanger(cssClassName,toChange,changeTo)
{
 for(i = 0; document.styleSheets.length > i; i++) //Mozilla
 {
  if(document.styleSheets[i].rules != undefined)
  {
   for(j = 0; document.styleSheets[i].rules.length > j; j++)
   {
    if(document.styleSheets[i].rules[j].selectorText.toLowerCase() == cssClassName)
    {
     document.styleSheets[i].rules[j].style[toChange] = changeTo;
    }
   }
  } else if(document.styleSheets[i].cssRules != undefined) //IE
  {
   
   for(j = 0; document.styleSheets[i].cssRules.length > j; j++)
   {
    
	if(document.styleSheets[i].cssRules[j].selectorText) {
		//alert("checking "+document.styleSheets[i].cssRules[j].selectorText+" for "+cssClassName);
		//if(document.styleSheets[i].cssRules[j].selectorText.toLowerCase() == cssClassName)
		testString1 = cssClassName+",";
		testString2 = cssClassName+" ,";
		testString3 = cssClassName;
		if(document.styleSheets[i].cssRules[j].selectorText.indexOf(testString1) != -1 || document.styleSheets[i].cssRules[j].selectorText.indexOf(testString2) != -1 || document.styleSheets[i].cssRules[j].selectorText.indexOf(testString3) != -1)
		{
		 document.styleSheets[i].cssRules[j].style[toChange] = changeTo;
		}
	}
   }
  } else
  {
   window.alert("Your browser won't support the changing of a style sheet by javascript!");
  }
 }
}

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 = "/blank.html";
 }
 }

 function showEdit(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('editpop').style.position = "absolute";
		document.getElementById('editpop').style.left = new_my_left;
		document.getElementById('editpop').style.marginLeft = 0;
		document.getElementById('editpop').style.top = new_my_top2;
		document.getElementById('editpop').style.marginTop = 0;
	}
 }
 else{ 
	 ds = 'none'; 
 }
 document.getElementById('loader_bg').style.display = ds;
 document.getElementById('editpop').style.display = ds;
  if(!show) {
	frames['editpop_frame'].location.href = "/blank.html";
 }
 }

function editQuestion(obj_id,filter,ts) {
	my_url = "/questions.cfm?action=edit&sub_action=basic_info&do_edit=1&q_id=" + obj_id + "&filter="+filter+"&time_span="+ts;
	frames['editpop_frame'].location.href = my_url;
	//alert(my_url);
	showEdit(1);
}

function editLink(obj_id,filter,ts) {
	my_url = "/links.cfm?action=edit&sub_action=basic_info&do_edit=1&link_id=" + obj_id + "&filter="+filter+"&time_span="+ts;
	frames['editpop_frame'].location.href = my_url;
	//alert(my_url);
	showEdit(1);
}

 function showPhoto(show){
 if(show){ ds = 'block'; }else{ ds = 'none'; }
 document.getElementById('loader_bg').style.display = ds;
 document.getElementById('big_photo').style.display = ds;
 if(!show) {
	frames['photo_frame'].location.href = "/blank.html";
 }
 }

function bigPhoto(photo_url,photo_width,photo_height,evt) {
	//alert(document.documentElement.scrollTop);
	if (document.all) {
		my_x = event.clientX + document.documentElement.scrollLeft;
		my_y = event.clientY + document.documentElement.scrollTop;
	}
	else {
		my_x = evt.pageX + document.documentElement.scrollLeft;
		my_y = evt.pageY + document.documentElement.scrollTop;
	}

	document.getElementById('big_photo').style.width = photo_width;
	document.getElementById('big_photo').style.height = photo_height + 30;
	//alert(document.getElementById('big_photo').style.top);
	document.getElementById('big_photo').style.top = my_y;
	//alert(document.getElementById('big_photo').style.top);
	document.getElementById('big_photo').style.left = my_x + 20;
	//my_margin_left = (photo_width/2) + 10;
	//my_margin_left = - my_margin_left;
	my_margin_top = (photo_height/2) + 30;
	if (my_margin_top > my_y) {
		my_margin_top = 150;
	}
	my_margin_top = - my_margin_top;
	new_mt = round_decimals(my_margin_top,0)
	document.getElementById('big_photo').style.marginTop = new_mt;
	frame_width = photo_width + 2;
	frame_height = photo_height + 30;
	document.getElementById('photo_frame').width = frame_width;
	document.getElementById('photo_frame').height = frame_height;
	frames['photo_frame'].location.href = "/shared/big_photo.cfm?photo_url="+photo_url+"&photo_width="+photo_width+"&photo_height="+photo_height;
	showPhoto(1);
}

function AddText(NewCode){document.newmess_form.comment.value+=NewCode}
function hyperlink() {
	link_error = 0;
	txt2=prompt("Text to be shown for the link.\n\nExample: 'Google'","");
	if(!txt2) {
		alert("No text entered.");
	}
	else {
		txt=prompt("URL for the link (including 'http://').\n\nExample: 'http://www.google.com'","");
			
		if ((txt.indexOf('http://') == -1 && txt.indexOf('https://') == -1) || txt.indexOf('.') == -1) {
			alert("Properly formed URL not entered.");
		}
		else {
			AddTxt="[url="+txt+"]"+txt2+"[/url]";
			AddText(AddTxt);
		}
	}
}

function setSubscribe(id) {
	url = "/shared/set_subscribe.cfm?id="+id;
	frames['ifexec'].location.href = url;
}


function recVote(id,vote,obj_type,v_type) {
	url = "/shared/rec_vote.cfm?id="+id+"&vote="+vote+"&obj_type="+obj_type+"&v_type="+obj_type;
	frames['ifexec'].location.href = url;
}
function thankVote(success,nl,id) {
	key = "like_vote" + id;
	key_count = "like_count" + id;
	if (success == 1) {
		document.getElementById(key).innerHTML = "Saved";
		if (nl > 0) {
			document.getElementById(key_count).innerHTML = "+"+nl;
		}
		else {
			document.getElementById(key_count).innerHTML = nl;
		}
	}
	else {
		document.getElementById(key).innerHTML = "(Voted)";
	}
}

function recRating(id,rating,obj_type,v_type) {
	url = "/shared/rec_rating.cfm?id="+id+"&rating="+rating+"&obj_type="+obj_type+"&v_type="+obj_type;
	frames['ifexec'].location.href = url;
}
function thankRating(success,nr,id) {
	key = "rating_area" + id;
	
	if (success == 1) {
		document.getElementById(key).innerHTML = "New Rating: "+nr;
	}
	else {
		document.getElementById(key).innerHTML = "Already Rated";
	}
}

function addFav(my_id,obj_type,my_size) {
	//my_key = "star" + my_id;
	//document.getElementById(my_key).src='/art/star_yellow_bold.gif';
	frames['ifexec'].location.href="/shared/set_fav.cfm?id="+my_id+"&obj_type="+obj_type+"&size="+my_size;
}
function setApprove(my_id,obj_type,app_num) {
	frames['ifexec'].location.href="/shared/set_app.cfm?id="+my_id+"&obj_type="+obj_type+"&app_num="+app_num;
}
function setHome(my_id,obj_type) {
	frames['ifexec'].location.href="/shared/set_home.cfm?id="+my_id+"&obj_type="+obj_type;
}

function remFav(my_id,obj_type,my_size,fav_id) {
	my_key = "listing" + my_id;
	document.getElementById(my_key).style.display="none";
	my_key = "listing2" + my_id;
	document.getElementById(my_key).style.display="none";	frames['ifexec'].location.href="/shared/set_fav.cfm?action=rem&id="+my_id+"&obj_type="+obj_type+"&size="+my_size+"&fav_id="+fav_id;
}

function favNoLogin() {
	alert('You need to be logged in to add to your favorites.');
}
function favMessage(my_div,my_size) {
	//alert(my_div);
	if (my_size == "small") {
		document.getElementById(my_div).innerHTML = "Added";
	}
	if (my_size == "large") {
		document.getElementById(my_div).innerHTML = "Added";
	}
}
function appMessage(my_div,my_message) {
	document.getElementById(my_div).innerHTML = "<span class='approver'>" + my_message + "</span>";
}
function homeMessage(my_div,my_message) {
	document.getElementById(my_div).innerHTML = "<span class='approver'>" + my_message + "</span>";
}

function flagMessage(my_div) {
	document.getElementById(my_div).innerHTML = "Flagged";
}

function flagNoLogin() {
	alert('You need to be logged in to set a flag.');
}
function setFlag(my_id,flag_type) {
	loader_frame.location="/shared/set_flag.cfm?id="+my_id+"&obj_type="+flag_type;
	showLoader(1);
}
function editFlag(my_id,flag_type) {
	loader_frame.location="/shared/edit_flag.cfm?id="+my_id+"&obj_type="+flag_type;
	showLoader(1);
}

function setShare(my_id,flag_type) {
	loader_frame.location="/shared/send_email.cfm?id="+my_id+"&obj_type="+flag_type;
	showLoader(1);
}


function setDelete(my_id,obj_type) {
	loader_frame.location="/shared/set_delete.cfm?id="+my_id+"&obj_type="+obj_type;
	showLoader(1);
}

function setPrivate(my_id,obj_type) {
	loader_frame.location="/shared/set_private.cfm?id="+my_id+"&obj_type="+obj_type;
	showLoader(1);
}

function setDeleteComment(my_id,archive) {
	loader_frame.location="/forum_scripts/set_delete_comment.cfm?id="+my_id+"&archive="+archive;
	showLoader(1);
}

function setLockComment(my_id,archive) {
	loader_frame.location="/forum_scripts/set_lock_comment.cfm?id="+my_id+"&lock_action="+archive;
	showLoader(1);
}

function imageBox() {
	loader_frame.location="/shared/upload_image.cfm?image_type=forum";
	showLoader(1);
}
function smileHelp() {
	loader_frame.location="/forum_scripts/smile_help.cfm";
	showLoader(1);
}
function numDebate() {
	loader_frame.location="/forum_scripts/numerical_debating.cfm";
	showLoader(1);
}


function sendAgain() {
	document.getElementById('email_sent_message').style.display='none';
	document.getElementById('email_sender').style.display='block';
}
function previewEmbed(embed_code,photo_width,photo_height,evt) {
		//alert(document.documentElement.scrollTop);
	if (document.all) {
		my_x = event.clientX + document.documentElement.scrollLeft;
		my_y = event.clientY + document.documentElement.scrollTop;
	}
	else {
		my_x = evt.pageX + document.documentElement.scrollLeft;
		my_y = evt.pageY + document.documentElement.scrollTop;
	}

	document.getElementById('big_photo').style.width = photo_width;
	document.getElementById('big_photo').style.height = photo_height + 30;
	//alert(document.getElementById('big_photo').style.top);
	document.getElementById('big_photo').style.top = my_y;
	//alert(document.getElementById('big_photo').style.top);
	document.getElementById('big_photo').style.left = my_x + 20;
	my_margin_left = (photo_width/2) + 10;
	my_margin_left = - my_margin_left;
	my_margin_top = (photo_height/2) + 30;
	if (my_margin_top > my_y) {
		my_margin_top = 150;
	}
	my_margin_top = - my_margin_top;
	new_mt = round_decimals(my_margin_top,0)
	document.getElementById('big_photo').style.marginTop = new_mt;
	frame_width = photo_width + 2;
	frame_height = photo_height + 30;
	document.getElementById('photo_frame').width = frame_width;
	document.getElementById('photo_frame').height = frame_height;
	frames['photo_frame'].location.href = "/shared/preview_embed.cfm?embed_code="+embed_code;
	showPhoto(1);
}


function checkAllF(field) { 
	for (i = 0; i < field.length; i++) {
		field[i].checked = true ; 
	}
}

function uncheckAllF(field) { 
	for (i = 0; i < field.length; i++) {
		field[i].checked = false ; 
	}
}




//-->