//
// (c) 2003 iPulse.com
// written by Stefan Wendt
//

function closeMyExtraWin()
{
	try {
		myWindow.close();
	}
	catch(e)
	{
		//ignor
	}
}
function openMyExtraWin( myURL, myTitle, xsize, ysize )
{
	var myOptions= "width=" + xsize + ",height=" + ysize + ",resizable=yes,menubar=no,scrollbars=yes";
	myWindow=window.open(myURL,myTitle,myOptions);

	window.onunload= closeMyExtraWin;

	myWindow.focus();
}

function openMyExtraWin_NoSize( url, title )
{
	var options= "";
	myWindow=window.open(url, title, options);
	myWindow.focus();
}

function goToURL( url )
{
	window.location= url;
}

function pleaseWait( formid )
{
	if ( this.document.forms[formid].elements["formaction"].value != "" )
	{
		return;
	}
	scroll(0,0);
	document.getElementById("pleasewait").style.visibility = "visible";
}

function pleaseWaitAlert( url )
{
	alert("The following page takes time to process. Please wait until your browser finished loading the page!");
	window.location= url;
}

function formActionButton( formid, action, arg )
{
	this.document.forms[formid].elements["formaction"].value=action;
	this.document.forms[formid].elements["formaction_arg"].value=arg;
	this.document.forms[formid].submit();
}

function transferCheckinCheckout( ciyear, cimonth, ciday, coyear, comonth, coday )
{
	opener.document.forms["checkincheckout"].elements["ci_year"].value=ciyear;
	opener.document.forms["checkincheckout"].elements["ci_month"].value=cimonth;
	opener.document.forms["checkincheckout"].elements["ci_day"].value=ciday;
	opener.document.forms["checkincheckout"].elements["co_year"].value=coyear;
	opener.document.forms["checkincheckout"].elements["co_month"].value=comonth;
	opener.document.forms["checkincheckout"].elements["co_day"].value=coday;
	close();
	opener.document.forms["checkincheckout"].submit();
}

function formAction( formid, action )
{
	this.document.forms[formid].elements["formaction"].value=action;
	this.document.forms[formid].submit();
}

function readOnlyInputAlert( msg )
{
	alert( msg );
	this.blur();
}

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=/";
}

