function confirmdelete(url, msg)
{
	if ( ! msg )
	{
		msg = 'PLEASE CONFIRM:\nOK to proceed with delete?';
	}
	
	if (confirm( msg ))
	{
		window.location.href = url;
	}
}

//==========================================
// Hide / Unhide menu elements
//==========================================

function cb_showhide(id1, id2)
{
	if (id1 != '') cb_toggleview(id1);
	if (id2 != '') cb_toggleview(id2);
}
	
//==========================================
// Get element by id
//==========================================

function cb_getbyid(id)
{
	itm = null;
	
	if (document.getElementById)
	{
		itm = document.getElementById(id);
	}
	else if (document.all)
	{
		itm = document.all[id];
	}
	else if (document.layers)
	{
		itm = document.layers[id];
	}
	
	return itm;
}

//==========================================
// Show/hide toggle
//==========================================

function cb_toggleview(id)
{
	if ( ! id ) return;
	
	if ( itm = cb_getbyid(id) )
	{
		if (itm.style.display == "none")
		{
			cb_show_div(itm);
		}
		else
		{
			cb_hide_div(itm);
		}
	}
}

//==========================================
// Set DIV ID to hide
//==========================================

function cb_hide_div(itm)
{
	if ( ! itm ) return;
	
	itm.style.display = "none";
}

//==========================================
// Set DIV ID to show
//==========================================

function cb_show_div(itm)
{
	if ( ! itm ) return;
	
	itm.style.display = "";
}





function DetectIt () {

	this.detect = navigator.userAgent.toLowerCase();
	this.OS;
	this.browser;
	this.version;
	this.thestring;
	
	this.checkIt = detectIt_checkIt;
	
	if (this.checkIt('konqueror'))	{
		this.browser = "Konqueror";
		this.OS = "Linux";
	}
	
	else if (this.checkIt('safari')) this.browser = "safari";
	else if (this.checkIt('omniweb')) this.browser = "omniweb";
	else if (this.checkIt('opera')) this.browser = "opera";
	else if (this.checkIt('webtv')) this.browser = "webtv";
	else if (this.checkIt('icab')) this.browser = "icab";
	else if (this.checkIt('msie')) this.browser = "ie";
	else if (this.checkIt('firefox')) this.browser = "firefox";
	else if (!this.checkIt('compatible'))	{
		this.browser = "netscape";
		this.version = this.detect.charAt(8);
	}
	
	else this.browser = "An unknown browser";
	
	if (!this.version) this.version = this.detect.charAt(this.place + this.thestring.length);
	
	if (!this.OS)	{
		if (this.checkIt('linux')) this.OS = "linux";
		else if (this.checkIt('x11')) this.OS = "unix";
		else if (this.checkIt('mac')) this.OS = "mac"
		else if (this.checkIt('win')) this.OS = "windows"
		else this.OS = "an unknown operating system";
	}

}

function detectIt_checkIt(string)	{
	place = this.detect.indexOf(string) + 1;
	this.thestring = string;
	return place;
}

detect = new DetectIt();





function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toUTCString());
}


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 "";
}


$(document).ready(function() {
	$("body").prepend('<div id="dhtmltooltip" />');
});

/*
Text Link/Image Map Tooltip Script- 
© Dynamic Drive (www.dynamicdrive.com)
For full source code, and 100's more DHTML scripts
Visit http://www.dynamicdrive.com/dynamicindex5/texttool.htm
*/
if (!document.layers && !document.all && !document.getElementById) {
	event = "not supported";
}

function showtip(current,e,text) {
	if (document.all || document.getElementById) {
		thetitle = text.split('<br>');
		if (thetitle.length > 1){
			var temp_title = '';
			for (var i=0; i < thetitle.length; i++) {
				if (temp_title != '') {
					temp_title += '\n\r';	// doesn't quite work in NS7...
				}
				temp_title += thetitle[i];
			}
			current.title = temp_title;
		} else {
			current.title = text;
		}
	} else if (document.layers) {
		document.tooltip.document.write('<layer bgColor="#FFFF80" style="border:1px solid black;font-size:12px;">'+text+'</layer>');
		document.tooltip.document.close();
		document.tooltip.left = e.pageX+5;
		document.tooltip.top = e.pageY+5;
		document.tooltip.visibility = "show";
	}
}

function hidetip() {
	if (document.layers) {
		document.tooltip.visibility = "hidden";
	}
}


function ddrivetip(thetext, thecolor, thewidth, img_id){

	var e = $("[name="+img_id+"]");

	if (e) {
		e.attr('src',"http://www.runnerspace.com/results/images/video_over.png");
		$("#dhtmltooltip").html(thetext).css({left:e.offset().left+20+'px',top:e.offset().top+'px'}).show();
	}

}


function hideddrivetip(img_id) {

	var e = $("[name="+img_id+"]");

	if (e) {
		e.attr('src',"http://www.runnerspace.com/results/images/video_out.png");
		$("#dhtmltooltip").hide();
	}
	
}


$(document).ready(function() {

	if ($("table",".sharethis").length) {

		var SHARECHECK = setInterval(function() {
			var e = $("table",".sharethis");
			if ( e.width() >= parseInt(e.attr('summary')) ) { $(".sharethis").stop(true).animate({opacity:1}); clearInterval(SHARECHECK); }
		},750);
	}

});










