

var SV_AgencyID = 'thm'
var siteURL

//get the real active dns
siteURL = location.href
siteURL = siteURL.substring(7)
siteURL = siteURL.substring(0, siteURL.indexOf('/'))



//promo perfect vacation script
    var GB_ROOT_DIR = 'http://' + siteURL + "/Portals/3/perfectvacation/"; // this URL must be absolute
	

	document.write(unescape("%3Cscript src='http://www.clubvoyages.com/marlin/javascripts/greybox/AJS.js' type='text/javascript'%3E%3C/script%3E"));
	document.write(unescape("%3Cscript src='http://www.clubvoyages.com/marlin/javascripts/greybox/AJS_fx.js' type='text/javascript'%3E%3C/script%3E"));
	document.write(unescape("%3Cscript src='http://www.clubvoyages.com/marlin/javascripts/greybox/gb_scripts.js' type='text/javascript'%3E%3C/script%3E"));
	





function LoadSpecials(params)
{
	
	
	if(document.getElementById("RIGHTSPECIAL")) 	
		PassAjaxResponseToFunction("http://" + siteURL + "/redirect.asp?LINK=http://www.clubvoyages.com/marlin/asp/specials.asp?code_ag=thm-*-alias=thm-*-" + params, 'ShowSpecials')
	
}	

function ShowSpecials(response)
{
	document.getElementById("RIGHTSPECIAL").innerHTML = response
} 

//General Ajax function related to any Ajax library call

var debug = false;

function GetXmlHttp() {
  var xmlhttp = false;
  if (window.XMLHttpRequest)
  {
    xmlhttp = new XMLHttpRequest()
  }
  else if (window.ActiveXObject)
  {
    try
    {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP")
    } catch (e) {
      try
      {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP")
      } catch (E) {
        xmlhttp=false
      }
    }
  }
  return xmlhttp;
}


function PassAjaxResponseToFunction(url, callbackFunction, params)
{
  var xmlhttp = new GetXmlHttp();
  if (xmlhttp)
  {
    xmlhttp.onreadystatechange = 
            function ()
            {	
			  if (xmlhttp && xmlhttp.readyState==4)
              {
			  	
                if (xmlhttp.status==200)
                {
				 var response = xmlhttp.responseText
				 var functionToCall = callbackFunction + 
                                 '(response,'+params+')';
                  if(debug)
                  {
                    alert(response);
                    alert(functionToCall);
                  }			  
                  eval(functionToCall);
                } else if(debug){
                  document.write(xmlhttp.responseText);
                }
              }
            }
    xmlhttp.open("GET",url,true);
    xmlhttp.send(null);
  }
}


//load the css
document.write('<link rel="StyleSheet" href="http://www.clubvoyages.com/marlin/asp/styles.css" type="text/css">')
document.write(unescape("%3Clink href='http://www.clubvoyages.com/marlin/javascripts/greybox/gb_styles.css' rel='stylesheet' type='text/css' /"));

function InitFusepointAction()
	{	
		
		GetHiddenData()
		LoadSpecials('')
		PerfectVacation();
	}


function GetHiddenData()
{
	if (document.getElementById("portalinfo9"))
		SV_AgencyID = document.getElementById("portalinfo9").value

}

function ShiftGateway(code)
{
	LoadSpecials('GTY=' + code)
}

function LoadSVDeal(id)
{
	iframeCtn = '<IFRAME  align="center" src=""  width="100%" height="600" frameborder="0" scrolling="auto" id="SoftvoyageDeals" name="SoftvoyageDeals"></IFRAME>'
	
	if (document.getElementById("dnn_ctr496_HtmlModule_HtmlModule_lblContent"))
		document.getElementById("dnn_ctr496_HtmlModule_HtmlModule_lblContent").innerHTML = iframeCtn 
	else
		document.getElementById("BODYSPECIAL").innerHTML = iframeCtn 

	document.getElementById("SoftvoyageDeals").src = 'http://thm.sax.softvoyage.com/cgi-bin/resultadv.cgi?code_ag=thm&alias=' + SV_AgencyID + '&language=en&id=' + id
}

function AdvSearch()
{
	AdvLink = "http://" + siteURL + "/" + document.getElementById("portalinfo10").value + '?GCTabId=661'
	if (AdvLink != '')
		top.location.href = AdvLink 
	else
	{
		iFramCode = '<iframe src="http://thm.sax.softvoyage.com/cgi-bin/dev/query.cgi?code_ag=thm&alias=' + SV_AgencyID + '&language=en" width="100%" height="600" frameborder="0" scrolling="auto" ></iframe>'
		if(document.getElementById("dnn_ctr496_HtmlModule_HtmlModule_lblContent"))
			document.getElementById("dnn_ctr496_HtmlModule_HtmlModule_lblContent").innerHTML = iFramCode 
		else
			document.getElementById("BODYSPECIAL").innerHTML = iFramCode 
	}	
}


function PerfectVacation()
{
	if (location.href.indexOf('mini=1') > 0)
		GB_showCenter("", "http://yourperfectvacation.marlin-travel.ca/mini.aspx?alias=" + SV_AgencyID, 560, 885);
}

function showMinisite()
{
	GB_showCenter("", "http://yourperfectvacation.marlin-travel.ca/mini.aspx?alias=" + SV_AgencyID, 560, 885);
}


function RedirectBannerLink(url, target)
{
	if (url.indexOf('&') > 0)
		sep = '&'
	else
		sep = '?'


	if (target == 'top')
	{
		location.href=url + sep + 'code_ag=thm&alias=' + SV_AgencyID 
	}
	else
	{
		window.open(url + sep + 'code_ag=thm&alias=' + SV_AgencyID)
	}
}
