/////////////////////////////////////////////////////////////////////////////////////////////
// función de centrado de ventanas popup
/////////////////////////////////////////////////////////////////////////////////////////////

var win = null;

function NewWindow(mypage,myname,w,h,scroll){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
	
	win = window.open(mypage,myname,settings)
	
	if(win.window.focus){
		win.window.focus();
	}
}

///////////////////////////////////////////////////////////////////////////////////////////////
// con este Script desactivamos el botón derecho del ratón
///////////////////////////////////////////////////////////////////////////////////////////////
//	var message="I.S.G.F. Informes Comerciales S.L."; 
//	function click(e) {
//		if (document.all) {
//			if (event.button == 2) {
//				alert(message);
//				return false;
//			}
//		}
//		if (document.layers) {
//			if (e.which == 3) {
//				alert(message);
//				return false;
//			}
//		}
//	}
//	if (document.layers) {
//		document.captureEvents(Event.MOUSEDOWN);
//	}
//	document.onmousedown=click;

/////////////////////////////////////////////////////////////////////////////////////////////////
// función para poner un mensaje en la barra de estado
/////////////////////////////////////////////////////////////////////////////////////////////////
		var barrabajo = "I.S.G.F. Informes Comerciales S.L."; 
		function barra()
		{
			window.status = barrabajo;
			timerID= setTimeout("barra()",1);
		}

/////////////////////////////////////////////////////////////////////////////////////////////////
// función para abrir una ventana CHROMELESS
/////////////////////////////////////////////////////////////////////////////////////////////////

function ChromelessWin(url, width, height) {
	theURL=url
	wname ="CHROMELESSWIN"
	W=width;
	H=height;
	windowCERRARa 		= "images/chromeless/close_a.gif"
	windowCERRARd 		= "images/chromeless/close_d.gif"
	windowCERRARo 		= "images/chromeless/close_o.gif"
	windowNONEgrf 		= "images/chromeless/none.gif"
	windowCLOCK			= "imgages/chromeless/clock.gif"
	windowREALtit		= " ť I.S.G.F. Informes Comerciales S.L."
	windowTIT 	    	= "<font face=verdana size=1>&nbsp;ť I.S.G.F. Informes Comerciales S.L.</font>"
	windowBORDERCOLOR   	= "#999999"
	windowBORDERCOLORsel	= "#999999"
	windowTITBGCOLOR    	= "#d2b48c"
	windowTITBGCOLORsel 	= "#ffe4b5"
	openchromeless(theURL, wname, W, H, windowCERRARa, windowCERRARd, windowCERRARo, windowNONEgrf, windowCLOCK, windowTIT, windowREALtit , windowBORDERCOLOR, windowBORDERCOLORsel, windowTITBGCOLOR, windowTITBGCOLORsel)
}

//recibe una fecha y devuelve si es correcta

function esfecha(dateStr)
{

	var datePat = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{4})$/;
	var matchArray = dateStr.match(datePat); // is the format ok?	
	if (matchArray == null) {
		return false;
	}

	month = matchArray[3]; // p@rse date into variables
	day = matchArray[1];
	year = matchArray[5];

	if (month < 1 || month > 12) { // check month range
		return false;
	}

	if (day < 1 || day > 31) {
		return false;
	}

	if ((month==4 || month==6 || month==9 || month==11) && day==31) {
		return false;
	}

	if (month == 2) { // check for february 29th
		var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
		if (day > 29 || (day==29 && !isleap)) {
			return false;
		}
	}
	return true; // date is valid

}






