//********************************************************************
//***** UTILS 
//********************************************************************
//Common javascript functions

function gotoUrlFromPopup(myURL)
{
 if (opener)
 {
  self.close();
  opener.focus();
  opener.document.location.href=myURL;
 }
 else
 {
  window.open(myURL,'main');
 }
 return false;
}

function PopUp(myURL,myWidth,myHeight,myLeft,myTop){

		//open new window.
		window.open(myURL,'newWin','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width='+myWidth+',height='+myHeight+',left='+myLeft+',top='+myTop);
}

function isEmail(emailValue)
        {
            var regEx = /^(['a-z0-9_\-\.]+)@(['a-z0-9_\-\.]+)\.([a-z]{2,5})$/; 
         
            if (!regEx.test(emailValue.toLowerCase())) 
                return false;

            return true;
        }

	
function PopUpInvoice(myURL, myWidth, myHeight ){
	window.open(myURL, 'newWin', 'left=0,top=0,resizable=yes,toolbar=no,menubar=yes,location=no,scrollbars=yes,width='+myWidth+',height='+myHeight)
	}	

function isNumeric(theString){
    var digits = "0123456789";

    for (i = 0; i < theString.length; i++) 
    { 
        if (digits.indexOf(theString.charAt(i)) == -1) 
            return false;
    }
    return true;
}

function Calendar(textBoxName)
{
    windowCalendar = window.open("/common/includes/Calendar.aspx?textbox=" + textBoxName,
                                "Calendar",
                                "toolbar=0,menubar=0,directories=0,location=0,status=0,resizable=0,scrollbars=0," +
                                "width=250,height=180,left=450,top=275");
}

function Trim(str)
{
    return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}



//Fixes flickering in IE6 (added 01/24/08)
ie = document.all;
	if(ie)
	{
	try {
	document.execCommand("BackgroundImageCache", false, true);
	} catch(err) {}
}


//********************************************************************
//***** END UTILS 
//********************************************************************



