﻿// JScript File

function searchPickup()
{	
//	showPopWin("PopupFrameset.aspx?url=AddressUS.aspx?type=p", 720, 520, null);
showPopWin("PopupFrameset.aspx?url=AddressSearch.aspx?type=p", 720, 520, null);
}

function searchDestination()
{    
    var pickup = document.getElementById ('hdnPickup').value;
	if (pickup == "") 
	{
//	    alert("Please enter Pickup details");
//	    return false;
	}
	//showPopWin("PopupFrameset.aspx?url=AddressUS.aspx?type=d", 720, 520, null);
showPopWin("PopupFrameset.aspx?url=AddressSearch.aspx?type=d", 720, 520, null);
}

function RsearchPickup()
{	
//	showPopWin("PopupFrameset.aspx?url=AddressUS.aspx?type=jp", 720, 520, null);
showPopWin("PopupFrameset.aspx?url=AddressSearch.aspx?type=jp", 720, 520, null);
}


function RsearchDestination()
{    
    var jpickup = document.getElementById ('hdnReturnPickup').value;
	if (jpickup == "") 
	{
//	    alert("Please enter Return Pickup details");
//	    return false;
	}
//	showPopWin("PopupFrameset.aspx?url=AddressUS.aspx?type=jd", 720, 520, null);
showPopWin("PopupFrameset.aspx?url=AddressSearch.aspx?type=jd", 720, 520, null);
}



function searchAddress()
{	
	//showPopWin("PopupFrameset.aspx?url=AddressSearch.aspx?", 600, 400, null);
	showPopWin("PopupFrameset.aspx?url=AddressSearch.aspx?type=p", 720, 520, null);
}


if(window.dialogArguments) 
var openerWindow = window.dialogArguments;

function importPickupDetails(ID)
{
	__doCustomPostBack("ImportPickupDetails", ID);
}
function importDestinationDetails(ID)
{
		__doCustomPostBack("ImportDestinationDetails", ID);
}


function searchValidate()
{
var searchkey = document.getElementById ('txtSearch').value;
var City = document.getElementById ('txtCity').value;
var PState=document.getElementById ('ddlState').value;

    if(searchkey == "")
	{
	  alert("Please enter the Name search");
	  document.getElementById ('txtSearch').focus();
	  return false;
	}
	else
	{
    var regname = /^[./A-Za-z ,(,),#, ,-,.]+$/;
    var AlphaNumeric = /^[\w\s\d\)\(\#, ,.,-]*$/;
        if(!regname.test(searchkey) && !AlphaNumeric.test(searchkey))
        {
            alert('Please Enter only Alphabets & Alphanumerics');
            document.getElementById('txtSearch').focus();
		    document.getElementById('txtSearch').select();
            return false;
            
        }
	}

    if(City == "")
	{
	  alert("Please enter the City/Town ");
	  document.getElementById ('txtCity').focus();
	  return false;
	}
	else
	{
	var regname = /^[./A-Za-z ]+$/;
    var AlphaNumeric = /^[\w\s\d]*$/;
        if(!regname.test(City) && !AlphaNumeric.test(City))
        {
            alert('Please Enter only Alphabets & Alphanumerics');
            document.getElementById('txtCity').focus();
		    document.getElementById('txtCity').select();
            return false;
        }
	}
	
	 if (PState == "Select State")
	 {
	     alert("Please select Country/State");
	     document.getElementById ('ddlState').focus();
		 return false;
	 }
}

function importJPickupDetails(ID)
{		
	__doCustomPostBack("ImportJPickupDetails", ID);
}
function importJDestinationDetails(ID)
{
		__doCustomPostBack("ImportJDestinationDetails", ID);
}

// Apart from Airport search

function WinCloseY(Address){
__doCustomPostBack("ImportYAddressDetails", Address);
}

//function WinCloseYD(Address){
//__doCustomPostBack("ImportYDAddressDetails", Address);
//}

//function WinCloseYR(Address){
//__doCustomPostBack("ImportYRAddressDetails", Address);
//}

//function WinCloseYRD(Address){
//__doCustomPostBack("ImportYRDAddressDetails", Address);
//}

// Airport search

function WinCloseP(ID){
		__doCustomPostBack("ImportPickupDetails", ID);
}

function WinCloseD(ID){
		__doCustomPostBack("ImportDestinationDetails", ID);

}
function WinCloseJP(ID){
		__doCustomPostBack("ImportJPickupDetails", ID);
}

function WinCloseJD(ID){
		__doCustomPostBack("ImportJDestinationDetails", ID);

}


var previousRowBgColour,previousRowColour,selectedRow,checkrow;
function ShowGVColor(row)
{
       if(selectedRow)
        {
		selectedRow.style.backgroundColor = previousRowBgColour; //"#FFFFFF";
		selectedRow.style.color = previousRowColour; //"#000000";
	    }	
	previousRowBgColour = row.style.backgroundColor;
	previousRowColour = row.style.color;	
	row.style.backgroundColor = "#316AC6";
	row.style.color = "#FFFFFF";
	selectedRow = row;	
}


