/* 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
        */
 		var blnIsIe9 = false;
        if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
          var ieversion=new Number(RegExp.$1); // capture x.x portion and store as a number
          if (ieversion>=9){
                blnIsIe9 = true;
            }
         }

        if (!document.getElementById('divbackdrop'))
        {
            //Create a new backdrop div
            var t = document.createElement('div');
            t.id = 'divbackdrop';
            t.style.opacity = '.75';
            t.style.filter = 'alpha(opacity=75)';
            t.style.position = 'absolute';
            t.style.backgroundColor = '#000000';
            t.innerHTML = '&nbsp;';
            t.style.display = 'none';
            t.style.zIndex = 100;
            t.style.left = 0;
            t.style.top = 0;
 	    	if (!blnIsIe9) 
 	    	{
                t.style.float = 'center';
            }
            document.body.appendChild(t);
        }
        var b = document.getElementById('divbackdrop');
        b.style.display = 'block';
        b.style.width = GetPageWidth() + 'px';
        b.style.height = GetPageHeight() + 'px';
       
        
        //b.style.left = GetScrollX();
        //b.style.top = GetScrollY();
        CenterDisplay(tid);
        document.getElementById(tid).style.display = 'block';
        document.getElementById(tid).style.zIndex = 1000;
        document.body.style.overflow="hidden";
        HideElement('APPLET', tid);
        HideElement('SELECT', tid);
    }
    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';
    
    //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 sendThank(p,s,sn,r,rn)
{
	var x='<div style="font-family:Courier New;font-size:12px">MSG</div>'
	var m='<p style="font-weight:bold;text-decoration:underline;">THIS IS AN AUTOMATED RESPONSE.  Please do not reply to this e-mail.</p>'
	m+='Dear '+rn+',';
	m+='<p>Thank you for your e-mail.  We\'ve received it and are routing it to the appropriate staff for handling and response.  You should hear from us very shortly.<br/>Thank you again for contacting us.</p>'
	m+='<p>Sincerely,<br/><br/>The Regina Tours Team<br/>800-CATHOLIC (800-228-4654)</br>sales4us@regina-tours.com</p>'
	x=x.replace(/MSG/g,m);

	var u='&action=SENDEMAIL';
	u+='&txtToAddress='+r
	u+='&txtToName='+rn;
	u+='&txtFromName='+sn;
	u+='&txtReplyTo='+s;
	u+='&txtSubject=Thank you for contacting regina-tours.com'
	u+='&txtBody='+x

	var eUrl=p+u;
	var s=includeURL(eUrl); //just to execute the email subcription

}

function SetAltRowColor(tblId)
{
	var tdRow = document.getElementById(tblId).getElementsByTagName('td')
	var tdLen = tdRow.length;
	var tdOdd='#ecead0';
	var tdEven='#e2dfb9';
	
	for (var intCtr=0;intCtr < tdLen;intCtr++)
	{
		if ((intCtr % 2)==0)
		{
			tdRow[intCtr].style.background = tdEven;
			tdRow[intCtr].onmouseout=function(){this.style.background = tdEven};
		}
		else 
		{
			tdRow[intCtr].style.background = tdOdd;
			tdRow[intCtr].onmouseout=function(){this.style.background = tdOdd};
		}
	}
}	

function tellafriend(ths)
{
	var tl=document.title;
	var t='mailto:'+ths.value+'?subject='+tl;
	t+='&body=Just wanted to let you know about this cool page on the Regina Tours web site! You can see this page at '+window.location; location.href = t;
}

