if(!Array.indexOf) {
	Array.prototype.indexOf = function(obj)
	{
		for(var i = 0; i < this.length; i++)
		{
			if(this[i] == obj)
				return i;
		}
		return -1;
	}
}

function livePopup( cid, sid )
{
  if( cid )
    window.open( "http://live.offroadpro.net/?cid=" + cid + "&sid=" + sid + "", "op_live", "location=0,toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=900,height=600,left=62,top=0" );
  else
    window.open( "http://live.offroadpro.net/?sid=" + sid + "", "op_live", "location=0,toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=900,height=600,left=62,top=0" );
}


function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function urlLocation(url) {
        document.location = url;
}

function yourOS() {
    var ua = navigator.userAgent.toLowerCase();
    if (ua.indexOf("win") != -1) {
        return "Windows";
    } else if (ua.indexOf("mac") != -1) {
        return "Macintosh";
    } else if (ua.indexOf("linux") != -1) {
        return "Linux";
    } else if (ua.indexOf("x11") != -1) {
        return "Unix";
    } else {
        return "Computers";
    }
}

$(document).ready(function()
{
	$('a.remove').livequery('click', function(evnt)
	{
		var title = $(this).attr('title');
		evnt.stopPropagation();
		return confirm('Oletko varma että haluat poistaa "'+title+'"?');
	});

	$('.required').prepend('<span style="font-size: 12px; color: red;">*</span>');
});
