function Show(what)
{
	//alert(what);
	//alert(document.all.back_flight_dis.style.display);
	//alert(document.all.back_flight.style.display);
	
	if (what == "backflight")
		{
		document.all.back_flight_dis.style.display = "none";
		document.all.back_flight.style.display = "block";
		}
	else if (what == "nobackflight")
		{
		document.all.back_flight_dis.style.display = "block";
		document.all.back_flight.style.display = "none";
		}
}

var t_gif = new Image();
t_gif.src = "images/t.gif";

var imgsearch_disabled = new Image();
imgsearch_disabled.src = "images/but_search_disabled.gif";

var imgbook_disabled = new Image();
imgbook_disabled.src = "images/but_book_disabled.gif";

var imgconfirm_disabled = new Image();
imgconfirm_disabled.src = "images/but_confirm_disabled.gif";

function ChangeButColor(but)
{
	var item = eval("document.all." + but + "_td");
	item.style.backgroundImage = "url(images/but_blue_bottom_bg.gif)";
	
	var img1 = eval("document." + but + "_right");
	img1.src = "images/but_blue_bottom_right.gif";
	
	var img2 = eval("document." + but + "_left");
	img2.src = "images/but_blue_bottom_left.gif";
}

function ReturnButColor(but)
{
	var item = eval("document.all." + but + "_td");
	item.style.backgroundImage = "url(images/but_orange_bottom_bg.gif)";
	
	var img1 = eval("document." + but + "_right");
	img1.src = "images/but_orange_bottom_right.gif";
	
	var img2 = eval("document." + but + "_left");
	img2.src = "images/but_orange_bottom_left.gif";
}

function pop(usa)
{
	window.open("forgot.asp?usa="+usa ,"forgot","width=230,height=180,left=350,top=200,toolbars=no");
}

function pop_up()
{
	window.open("pop_up.asp","pop","width=650,height=240,left=50,top=100,toolbars=no");
}

//Input only English and Space
function CheckInput(oInbox)
{
	if (event.keyCode != 32)//space
	{
		if (event.keyCode < 65 || event.keyCode > 90)//a-z
		{
			if (event.keyCode < 97 || event.keyCode > 122)//A-Z
			{
				event.keyCode = 0;	
			}
		}
	}
}

function spawnWindow(desktopURL,windowName,width,height,scroll) // for details(pratim) for muadon lakohot 
{
	window.open(desktopURL, windowName, "toolbars=no,resizable=yes,top=250,left=350,scrollbars="+scroll+",width="+width+",height="+height );
}


function suycDateDiff(start, end, interval, rounding) {

    var iOut = 0;
    
    // Create 2 error messages, 1 for each argument. 
    var startMsg = "Check the Start Date and End Date\n"
        startMsg += "must be a valid date format.\n\n"
        startMsg += "Please try again." ;
		
    var intervalMsg = "Sorry the dateAdd function only accepts\n"
        intervalMsg += "d, h, m OR s intervals.\n\n"
        intervalMsg += "Please try again." ;

    var bufferA = Date.parse(start);
    var bufferB = Date.parse(end);
    	
    // check that the start parameter is a valid Date. 
    if ( isNaN (bufferA) || isNaN (bufferB) ) {
        //alert(startMsg) ;
        return null;
    }
	
    // check that an interval parameter was not numeric. 
    if ( interval.charAt == 'undefined' ) {
        // the user specified an incorrect interval, handle the error. 
        alert( intervalMsg ) ;
        return null ;
    }
    
    var number = bufferB-bufferA ;
    
    // what kind of add to do? 
    switch (interval.charAt(0))
    {
        case 'd': case 'D': 
            iOut = parseInt(number / 86400000) ;
            if(rounding) iOut += parseInt((number % 86400000)/43200001) ;
            break ;
        case 'h': case 'H':
            iOut = parseInt(number / 3600000 ) ;
            if(rounding) iOut += parseInt((number % 3600000)/1800001) ;
            break ;
        case 'm': case 'M':
            iOut = parseInt(number / 60000 ) ;
            if(rounding) iOut += parseInt((number % 60000)/30001) ;
            break ;
        case 's': case 'S':
            iOut = parseInt(number / 1000 ) ;
            if(rounding) iOut += parseInt((number % 1000)/501) ;
            break ;
        default:
        // If we get to here then the interval parameter
        // didn't meet the d,h,m,s criteria.  Handle
        // the error. 		
        alert(intervalMsg) ;
        return null ;
    }
    
    return iOut ;
}


function FixToUSDate(tempDate)
{
	var tmpArr;
	var tmpStr;
	tmpArr = String(tempDate).split('/');
	tmpStr = tmpArr[1] + '/' + tmpArr[0] + '/' + tmpArr[2];
	return tmpStr;
}
