function newWindow(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) / 18;
	var wint = (screen.height - h) /16;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',status=yes , scrollbars='+scroll+',resizable'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function addfriendlookup(){
	airport_window = window.open('AddFriendLookup.aspx','airport_window','width=550,height=500,scrollbars=yes, resizable');
	airport_window.focus()
}

function airportlookup(aformfieldname){
	airport_window = window.open('airportlookup.aspx?formname=' + aformfieldname,'airport_window','width=550,height=500,scrollbars=yes, resizable');
	airport_window.focus()
}

function calendarpopup(aformfieldname){
	calwindow = window.open('calendar.aspx?formname=' + aformfieldname,'calwindow','width=200,height=250');
	calwindow.focus()
}
/*Users that are operators*/
function useroperatorlookup(aformfieldname){
	user_window = window.open('adminuseroperatorlookup.aspx?restart=true&formname=' + aformfieldname,'user_window','width=500,height=500scrollbars=yes, resizable');
	user_window.focus()
}
/*All kind of users used in AdminRfqPost*/
function userlookup(aformfieldname){
	user_window = window.open('userlookup.aspx?formname=' + aformfieldname,'user_window','width=500,height=500');
	user_window.focus()
}

function operatorlookup(aformfieldname){
	operator_window = window.open('operatorlookup.aspx?formname=' + aformfieldname,'operator_window','width=500,height=500,scrollbars=yes');
	operator_window.focus()
}

function userlookupappend(aformfieldname){
	user_window = window.open('userlookup.aspx?append=true&formname=' + aformfieldname,'user_window','width=500,height=500,scrollbars=yes');
	user_window.focus()
}

function salesreplookupappend(aformfieldname){
	user_window = window.open('salesreplookup.aspx?append=true&formname=' + aformfieldname,'user_window','width=500,height=500,scrollbars=yes');
	user_window.focus()
}
		
function aircraftlookup(aformfieldname){	
	aircraft_window = window.open('aircraftlookup.aspx?formname=' + aformfieldname,'aircraft_window','width=650,height=500,scrollbars=yes');
	aircraft_window.focus()
}	

function calendartimepopup(aformfieldname){
	caltimewindow = window.open('DateTimePicker.aspx?formname=' + aformfieldname,'calwindow','width=350,height=250');
	caltimewindow.focus()
}

function setbidgrouplegspopup(aRfqID, aBidGroupID){
	bidgrouplegswindow = window.open('AdminSetBidGroupLegs.aspx?RfqID=' + aRfqID + '&BidGroupID=' + aBidGroupID,'bidgrouplegswindow','width=600,height=500,scrollbars=yes');
	bidgrouplegswindow.focus()
}

function alertreasonpopup(aRfqID){
	alertreasonwindow = window.open('AdminRfqAlertReason.aspx?RfqID=' + aRfqID,'alertreasonwindow','width=300,height=100,scrollbars=yes');
	alertreasonwindow.focus()
}
function OneStat_Pageview() {
    var d=document;
    var sid="296171"
    var CONTENTSECTION="";
    var CUSTOMDATA="";
    var osp_URL= d.URL;
    var osp_Title= d.title;
    var t=new Date();
    var p="http"+(document.URL.indexOf('https:')==0?'s':'')+"://stat.onestat.com/stat.aspx?tagver=2&sid="+sid;
    p+="&url="+escape(osp_URL);
    p+="&ti="+escape(osp_Title);
    p+="&section="+escape(CONTENTSECTION);
    p+="&custom="+escape(CUSTOMDATA);
    p+="&rf="+escape(parent==self?window.document.referrer:top.document.referrer);
    p+="&tz="+escape(t.getTimezoneOffset());
    p+="&ch="+escape(t.getHours());
    p+="&js=1";
    p+="&ul="+escape(navigator.appName=="Netscape"?navigator.language:navigator.userLanguage);
    if (osp_URL!=d.URL)
        p+="&ol="+escape(d.URL);
    if (typeof(screen)=="object") {
        p+="&sr="+screen.width+"x"+screen.height;p+="&cd="+screen.colorDepth;
        p+="&jo="+(navigator.javaEnabled()?"Yes":"No");
    }
    d.write('<img id="ONESTAT_TAG" border="0" width="1" height="1" src="'+p+'" >');
}


function trim( vStr )
{
   return rtrim( ltrim( vStr ) )
}

function ltrim( vStr )
{
     while( true )
     {
         left = vStr.indexOf( ' ' )
         if ( left == -1 || left > 0 )
             break;
         else
             vStr = vStr.substring( left + 1, vStr.length );
     }
     return vStr
}

function rtrim( vStr )
{
     while( true )
     {
         right = vStr.lastIndexOf( ' ' )
         if ( right == -1 || right < vStr.length - 1 )
             break;
         else
             vStr = vStr.substring( 0, vStr.length - 1 );
     }
     return vStr
}

function textboxMultilineMaxNumber(txt,maxLen){
    try{
        if(txt.value.length > (maxLen-1))return false;
    }catch(e){}
}
