
//***********************************************************************
// 	indexOf function fix for Internet Explorer
//***********************************************************************

if (!Array.indexOf) {
	Array.prototype.indexOf = function(obj) {
		for(var i=0; i<this.length; i++) {
			if (this[i]==obj) {
				return i;
			}
		}
		return -1;
	}
}


//***********************************************************************
//	- Posem el focus al primer camp del formulari
//	- Canviem el color del border quan el camp agafa el focus o quan el perd
//***********************************************************************

$(document).ready(function() {	
	$(':input:visible:enabled:first').focus();
	
	/*$('input, textarea, select').focus(function(){
		$(this).css('border', '1px solid #D69728');
	});*/
	
	/*$('input, textarea, select').blur(function(){
		$(this).css('border', '1px solid #999999');
	});*/
});


function OpenWindow(url, w, h)
{
	var l = parseInt((screen.width - w)/2);
	var t = parseInt((screen.height - h)/2);
	var n = parseInt(Math.random() * 1000);
	var nw = window.open(url, "NewWindow" + n, "width=" + w + "px,height=" + h + "px,left=" + l + "px,top=" + t + "px");
	
	return nw;
}

function OpenWindowWScroll(url, w, h)
{
	var l = parseInt((screen.width - w)/2);
	var t = parseInt((screen.height - h)/2);
	var n = parseInt(Math.random() * 1000);
	var nw = window.open(url, "NewWindow" + n, "width=" + w + "px,height=" + h + "px,left=" + l + "px,top=" + t + "px,scrollbars=1");
}

