﻿function printpage() 
{
	window.open("/NewSite/Default.aspx?MenuID=" + document.getElementById("txtMenuID").value + "&CountryID=" + document.getElementById("txtCountryID").value + "&Command=Print", "", "scrollbars=yes,toolbar=yes,menubar=yes,resizable=yes");
}

function EmailContent()
{
	window.open("/NewSite/Email/Default.aspx?MenuID=" + document.getElementById("txtMenuID").value + "&CountryID=" + document.getElementById("txtCountryID").value, "", "scrollbars=yes,toolbar=no,width=560px,height=220px");
}

function PicturePopup(sImages, iWidth, iHeight)
{
	window.open(sImages, "", "scrollbars=yes,toolbar=no,width=" + iWidth + "px,height=" + iHeight + "px");
}
            
function comComboBox_OnChange(oComboBox)
{
    if (oComboBox.value != "")
    {
        window.location.href = oComboBox.value;
    }
}

function BookProduct(sID, sTourID, sMonth, sDay, oPassenger, oPromoCode)
{
    if (document.getElementById(oPassenger).value != "")
    {
        window.location.href = "/Booking/Booking/BookTour/Availability.aspx?ID=" + sID + "&TourID=" + sTourID + "&Month=" + sMonth + "&Date=" + sDay + "&Passengers=" + document.getElementById(oPassenger).value + "&PromoCode=" + document.getElementById(oPromoCode).value;
    }
    else
    {
        window.alert("Please Select Number of Passengers.");
    }
}

var sImageURL

function ChangePicture(sURL, sImage)
{
    sImageURL = document.all(sImage).src;
    document.getElementById(sImage).src = sURL;
}

function ChangeImage(sImage)
{
    document.getElementById(sImage).src = sImageURL;    
}

function SectionDisplay(sSection)
{
    if (document.getElementById(sSection).style.display == "")
    {
        document.getElementById(sSection).style.display = "none";
    }
    else
    {
        document.getElementById(sSection).style.display = "";
    }
}

function cmdSearch_OnClick(sTextBox, sFormID, sAction)
{
    this.document.forms["frmGoogle"].q.value = document.all(sTextBox).value;
    this.document.forms["frmGoogle"].cx.value = sFormID;
    this.document.forms["frmGoogle"].action = sAction;
    this.document.forms["frmGoogle"].submit();
}

function cmdVerticleResponse_OnClick(sEmail, sAction)
{
    this.document.forms["frmVerticleResponse"].email_address.value = document.getElementById(sEmail).value;
    this.document.forms["frmVerticleResponse"].action = sAction;
    this.document.forms["frmVerticleResponse"].submit();
}

function cmdWorldPayFullPayment_OnClick()
{
    getObject("oPaymentInfo").style.display = "none";
    getObject("iframeWorldPay").style.display = "";
    this.document.forms["frmWorldPayFullPayment"].submit();
}

function cmdWorldPayDeposit_OnClick() {
    getObject("oPaymentInfo").style.display = "none";
    getObject("iframeWorldPay").style.display = "";
    this.document.forms["frmWorldPayDeposit"].submit();
}

function cmdCyberSourceFullPayment_OnClick() {
    getObject("oPaymentInfo").style.display = "none";
    getObject("iframeWorldPay").style.display = "";
    this.document.forms["frmCyberSourceFullPayment"].submit();                         
}

function cmdCyberSourceDeposit_OnClick() {
    getObject("oPaymentInfo").style.display = "none";
    getObject("iframeWorldPay").style.display = "";
    this.document.forms["frmCyberSourceDeposit"].submit();
}

function cmdCyberSourceRetryPayment_OnClick() {
    this.document.forms["frmCyberSource"].submit();
}

function txtSearch_OnKeyDown(sImage)
{    
    switch (window.event.keyCode)
    {
	    case 13:
	        document.getElementById(sImage).click();
		    break;
    }
}

function txtSearch_OnFocus(sTextBox)
{
    document.getElementById(sTextBox).style.background = "#FFFFFF";
}

function txtSearch_OnBlur(sTextBox)
{
    document.getElementById(sTextBox).style.background = "#FFFFFF url(http://www.google.com/coop/images/google_custom_search_watermark.gif) left no-repeat";    
}

function cmdSubmit_OnClick()
{
    frmPost.submit();
}

function getObject(obj) 
{
    return document.getElementById(obj)
}

function scrollNews( newsDiv, toMove ) 
{
    theDiv = document.getElementById(newsDiv.toString());

	if ( theDiv == null ) { return; }

	if ( document.layers ) 
	{
		theDiv.clip.top = toMove;
		theDiv.clip.bottom = toMove + toClip;
		theDiv.top = theTop - toMove;
	} 
	else 
	{
		theDiv = theDiv.style;
		theDiv.clip = "rect(" + toMove + "px " + (theWidth + theLeft) + "px " + (toMove + toClip) + "px 0px)";
	                theDiv.top = (theTop - toMove) + "px"
	}

	if ( ( theTop + theHeight - toMove ) < ( theTop - theHeight - 20 ) ) 
	{
		toMove = 0;
		if ( document.layers ) 
		{
			theDiv.clip.top = theTop;
			theDiv.clip.bottom = toClip;
			theDiv.top = theTop
		} 
		else 
		{
			theDiv.clip = "rect(" + toMove + "px " + (theWidth + theLeft) + "px " + (toMove + toClip) + "px 0px)";
			theDiv.top = theTop + 'px';
		}
	}
	
	toMove = (toMove + 1);
	setTimeout("scrollNews('" + newsDiv + "'," + toMove + ")", 100);
}

function txtWaterMark_Focus(oControl, sText)
{
    if (oControl.value == sText)
    {
        oControl.value = "";
    }
    else
    {
        oControl.select();
    }
}

function txtWaterMark_LostFocus(oControl, sText)
{
    if (oControl.value == "")
    {
        oControl.value = sText;
    }
}

function PrintFrame(sFrame)
{
    window.frames[sFrame].focus(); 
    window.frames[sFrame].print(); 
}

function BeginRequestAjaxCorrection(sender, args)
{
    var oRequest = args.get_request();
    if (oRequest.get_headers()["X-MicrosoftAjax"])
    {
        var oBody = oRequest.get_body();
        var oHeader = "__MicrosoftAjax=" + encodeURIComponent(oRequest.get_headers()["X-MicrosoftAjax"]);
        if (oBody != null && oBody.length > 0)
        {
            oBody+="&";
        }
        else
        {
            oBody = "";
        }
        oRequest.set_body(oBody + oHeader);
    }       
}