﻿/* modalMe */
function modalMe() {
	elmt = document.getElementById("modalMe");
	elmt.style.visibility = (elmt.style.visibility == "visible") ? "hidden" : "visible";

}

function ShowModal(tid)
{
    try
    {
        /*
            -Create the backdrop
            -Show the backdrop
            -Show the requested element
            -Center the requested element
        */
        if (!document.getElementById('divbackdrop'))
        {
            //Create a new backdrop div
            var t = document.createElement('div');
            t.id = 'divbackdrop';
            document.body.appendChild(t)
        }
        var b = document.getElementById('divbackdrop');
        b.style.opacity = '.75';
        b.style.filter = 'alpha(opacity=75)';
        b.style.position = 'absolute';
        b.style.backgroundColor = '#000000';
        b.innerHTML = '&nbsp;';
        b.style.zIndex = 100;
        b.style.left = 0;
        b.style.top = 0;
        b.style.float = 'left';
        b.style.display = 'block';
        b.style.width = GetPageWidth() + 'px';
        b.style.height = GetPageHeight() + 'px';
       
        //b.style.left = GetScrollX();
        //b.style.top = GetScrollY();
        CenterDisplay('divbackdrop');
        CenterDisplay(tid);
        document.getElementById(tid).style.display = 'inline';
        document.getElementById(tid).style.zIndex = 1000;
        document.body.style.overflow="hidden";
        HideElement('APPLET', tid);
        HideElement('SELECT', tid);
        
        //alert('Backdrop: ' + document.getElementById('divbackdrop').style.zIndex + '\nItem (' + tid + '): ' + document.getElementById(tid).style.zIndex);
    }
    catch (ex)
    {
        //There was an error
        //alert('Overlay(' + tid + ') Failed: \n' + ex.description);
    }
}

function HideModal(tid)
{
    try
    {
        document.getElementById('divbackdrop').style.display = 'none';
        //document.getElementById('divbackdrop').style.overflow-x = 'auto';
        //document.getElementById('divbackdrop').style.overflow-y = 'auto';
        document.getElementById(tid).style.display = 'none';
        document.body.style.overflow="auto";
        ShowElement('APPLET');
        ShowElement('SELECT');
    }
    catch (ex)
    {
        //There was an error
        //alert('HideOverlay(' + tid + ') Failed: \n' + ex.description);
    }
}

function showsplash()
{
    CenterDisplay('idsplash');
    document.getElementById('idsplash').className = 'Splash-show'
}

function srciframe(idFrame,ihtml)
{
    var f = document.getElementById(idFrame);
    var a=new Date()
    var t=a.getTime();
    //load the url to iframe
    if (f.src != ihtml)
    {
        f.src = '';
        f.src = ihtml+'&'+t;
    }
}
function loadiframe(idDiv, idFrame,w,h,ihtml)
{
    
    var d = document.getElementById(idDiv);
    var f = document.getElementById(idFrame);
    var a=new Date()
    var t=a.getTime();

    //load the url to iframe
    f.src = ihtml+'&'+t;

    //frame style
    f.style.width = w + 'px';
    f.style.height = h + 'px';
    f.style.display = 'none';
    f.style.zIndex = 1000;
    
    //Set DIV style
    d.style.width = w + 'px';
    d.style.height = h + 'px';
    d.style.display = 'none';
    
    ShowModal(idDiv);    
    d.style.display = 'block';
    f.style.display = 'block';
    
}
function hideiframe(idDiv, idFrame)
{
    var d = document.getElementById(idDiv);
    var f = document.getElementById(idFrame);
    var b = document.getElementById('divbackdrop');

    //Set frame style
    //f.style.width = '0px';
    //f.style.height = '0px';
    f.style.display = 'none';
   
    //set div style
    //d.style.width = '0px';
    //d.style.height = '0px';
    d.style.display = 'none';

    HideModal(idDiv);
    if (b)
        b.style.display='none';
    
    f.src = '';
}

function ShowDIV(idiv,w,h)
{
    var d = document.getElementById(idiv);
    
    d.style.width = w + 'px';
    d.style.height = h + 'px';
    ShowModal(idiv);
}

function HideDIV(idiv)
{
    var d = document.getElementById(idiv);
    
    d.style.width = '0px';
    d.style.height = '0px';
    HideModal(idiv);
    HideProgram(idiv);
}

function ShowProgram(idiv,w,h)
{
    var a = document.getElementById('idItin');
    var d = document.getElementById(idiv);
    var i = document.getElementById('idHtlItem');
    var p = document.getElementById('id_Program');
    
    //i.style.display = 'none';
    //alert(a.innerHTML);
    d.innertHTML = a.innerHTML; 
    p.style.display = 'block';
    d.style.width = w + 'px';
    d.style.height = h + 'px';
    d.style.display = 'block';
    ShowModal(d);
    //alert(d.innerHTML);
    
}
function HideProgram(idiv)
{
    var d = document.getElementById(idiv);
    var i = document.getElementById('idHtlItem');
    var p = document.getElementById('id_Program');
    
    
    i.style.display = 'block';
    p.style.display = 'none';
    p.innertHTML = '';
    d.style.width = '0px';
    d.style.height = '0px';
    HideModal(idiv);
}

function execOurTrips(shref,grpid)
{
    var str = grpid.substring(1);

    if (str=='CONTACTUS')
        loadiframe('idModal','idIFrame','767','347',shref + str);
    else 
        document.location=shref + str;
}
function OpenNewWindow(turl,name)
{
    var wi=screen.width; //'width=100%,';       //width
    var he=screen.height; //'height=100%,';      //height
    var re='resizable=yes,';    //set if window is resizable
    var sc='scrollbars=yes,';   //set scrollbar
    var tb='toolbar=no,';       //set toolbar
    var lo='location=no,';       //display url location
    var di='directories=no,';
    var st='status=no,';
    var mn='menubar=no,';
    var ch='copyhistory=no';
    var a=wi+he+re+sc+tb+lo+di+st+mn+ch;
    window.open(turl,name,a);
}

function QryStr(strKey){try{var qs=window.location.search.substring(1).split("&");for(var i=0;i<qs.length;i++)if(qs[i].split("=")[0].toUpperCase()==strKey.toUpperCase())return qs[i].split("=")[1];return''}catch(ex){return''}}

function verifyinfo2()
{
        if(!document.getElementById('scrRPName').value)
        {
            alert('Invalid First Name'); 
            document.getElementById('scrRPName').focus();
            return false;
        }
        else if(!document.getElementById('scrRPLName').value)
        {
            alert('Invalid Last Name'); 
            document.getElementById('scrRPLName').focus();
            return false;
        }
        else if (!isValidEmail(document.getElementById('scrRPEmail').value))
        {
            alert('Invalid E-mail'); 
            document.getElementById('scrRPEmail').focus();
            return false;
        }
        return true;
}

function sendReqOLD(fp,upath)
{
    if (verifyinfo2()==true)
    {  
        var e='Magazine: YES';
        if (!document.getElementById('chkMagazine').checked == true)
        {
            e='Magazine: NO';
        }
        var u=upath;
        u=u+'&action=ADDBROCHUREREQUEST';
        u=u+'&reqtype=view';
        u=u+'&txtfirstname='+document.getElementById('scrRPName').value;
        u=u+'&txtcustomername='+document.getElementById('scrRPEmail').value;
        u=u+'&requestdesc='+e;
        var s=includeURL(u);
        OpenNewWindow(fp,'catalog')
        document.getElementById('scrRPName').value='';
        document.getElementById('scrRPEmail').value='';
    }
}

function sendReq(fp,upath)
{
    if (verifyinfo2()==true)
    {  

       var idDiv='idModal';
        var idFrame='idIFrame';
        var w='767';
        var h='347';
        
    var d = document.getElementById(idDiv);
    var f = document.getElementById(idFrame);
    var a=new Date()
    var t=a.getTime();

    


		var ul=upath;
		var u='&action=EmailSubscribe';
		u=u+'&txtfirstname='+document.getElementById('scrRPName').value;
		u=u+'&txtlaststname='+document.getElementById('scrRPLName').value;
		u=u+'&txtemail='+document.getElementById('scrRPEmail').value;
		u=u+'&subscribeaction=S'
		var lid='&listid=EMAIL-BROCHURE';
		var eUrl=ul+u+lid;
		var s=includeURL(eUrl); //just to execute the email subcription


		if (document.getElementById('chkMagazine').checked == true)
		{
			//alert('Requested to receive Expeditions | The Online Travel Magazine');
			lid='&listid=EMAIL-NEWSLTR';
			eUrl=ul+u+lid;
			var s=includeURL(eUrl); //just to execute the email subcription
		}
         	var locProtocol = (("https:" == document.location.protocol) ? "https" : "http");
            var tUrl='';
            if (locProtocol=='https'){tUrl='https://www.arzaworld.com/stw/STWDirectory.aspx?'}
            else {tUrl='http://www.arzaworld.com/stw/STWDirectory.aspx?'}
          

		


//load the url to iframe
    f.src = tUrl+'theme=ARZA&groupid=AW-THANKYOU&catalog=Y&fp='+fp + '&Name=' +document.getElementById('scrRPName').value;

    //frame style
    f.style.width = w + 'px';
    f.style.height = h + 'px';
    f.style.display = 'none';
    
    //Set DIV style
    d.style.width = w + 'px';
    d.style.height = h + 'px';
    d.style.display = 'none';
    
    ShowModal(idDiv);    
    d.style.display = 'block';
    f.style.display = 'block';

		//OpenNewWindow(fp,'catalog')
        document.getElementById('scrRPName').value='';
        document.getElementById('scrRPLName').value='';
        document.getElementById('scrRPEmail').value='';
    }
}


function hptransurl(url)
{
	parent.document.location=url;	

}
function tl(url){document.location=url;}


//
//
//
//--------This function below has been brought over from arza.js which is not being loaded anylonger
//
//
/* Set Menu Definition */
/*
    var timeout = 500;
    var closetimer = 0;
    var ddmenuitem = 0;
    
    $(document).ready(function() {
        $('#jsddm li ul').css('visibility', 'hidden');
    });

    function jsddm_open() {
        jsddm_canceltimer();
        jsddm_close();
        ddmenuitem = $(this).find('ul').css('visibility', 'visible');
    }

    function jsddm_close()
    { if (ddmenuitem) ddmenuitem.css('visibility', 'hidden'); }

    function jsddm_timer()
    { closetimer = window.setTimeout(jsddm_close, timeout); }

    function jsddm_canceltimer() {
        if (closetimer) {
            window.clearTimeout(closetimer);
            closetimer = null;
        } 
    }

    $(document).ready(function() {
        $('#jsddm > li').bind('mouseover', jsddm_open)
        $('#jsddm > li').bind('mouseout', jsddm_timer)
    });

    document.onclick = jsddm_close;
*/
/* Set Menu Definition */

/* Set Search input to empty in get focus */
function emptySearch(el) {

    if (!el) return false;
	el.value=(trim(el.value)).toLowerCase();
    if (el.value == "search") {
        el.value = "";
    } else if (el.value == "") {
        el.value = "Search";
    }
}
/* Set Search input to empty in get focus */

/* BEGIN LivePerson Monitor. */
//FIC 09/01/2009 *** BEGIN
//var lpMTagConfig = { 'lpServer': "server.iad.liveperson.net", 'lpNumber': "17283664", 'lpProtocol': "http" };
var locProtocol = (("https:" == document.location.protocol) ? "https" : "http");
//FIC 09/01/2009 *** END
if (locProtocol=='https'){var lpMTagConfig = { 'lpServer': "server.iad.liveperson.net", 'lpNumber': "17283664", 'lpProtocol': "https" };}
else {var lpMTagConfig = { 'lpServer': "server.iad.liveperson.net", 'lpNumber': "17283664", 'lpProtocol': "http" };}

function lpAddMonitorTag(src) {
    if (typeof (src) == 'undefined' || typeof (src) == 'object') {
        src = lpMTagConfig.lpMTagSrc ? lpMTagConfig.lpMTagSrc : '/hcp/html/mTag.js';
    }

    if (src.indexOf('http') != 0) {
        src = lpMTagConfig.lpProtocol + "://" + lpMTagConfig.lpServer + src + '?site=' + lpMTagConfig.lpNumber;
    } else {
        if (src.indexOf('site=') < 0) {
            if (src.indexOf('?') < 0) src = src + '?';
            else src = src + '&';
            src = src + 'site=' + lpMTagConfig.lpNumber;
        }
    };

    var s = document.createElement('script');
    s.setAttribute('type', 'text/javascript');
    s.setAttribute('charset', 'iso-8859-1');
    s.setAttribute('src', src);
    document.getElementsByTagName('head').item(0).appendChild(s);
}

if (window.attachEvent) window.attachEvent('onload', lpAddMonitorTag);
else window.addEventListener("load", lpAddMonitorTag, false);
/* END LivePerson Monitor. */

/* Ajax load pic first */
//$(function() {
    function preloadImg(image) {
        var img = new Image();
        img.src = image;
    }

    preloadImg('Pics/ajaxLoader.gif');

//});
/* Ajax load pic first */

/* Load Page DTR */
//window.onload = function() {$('.dtr').each(function() {string = $(this).text();filename = string.toLowerCase().replace(/ /g, '-').replace(/([^0-9a-z-])/g, '');$(this).html('<img src="Pics/' + filename + '.gif" alt="' + string + '" title="' + string + '" />');});};
//$(document).ready(function() {
//    $('.dtr').each(function() {
//        string = $(this).text();
//        filename = string.toLowerCase().replace(/ /g, '-').replace(/([^0-9a-z-])/g, '');
//        $(this).html('<img src="Pics/' + filename + '.gif" alt="' + string + '" title="' + string + '" />');
//    });
//});
/* Load Page DTR */