<!--//
/*
This file contains the javascript code for supporting the Avenue A action tags.
The main purpose of this function is to restrict the tags to only the
hollandamerica host name.

change log
03/09/05 aup Added   sendActionTagOnClick for ssr # 20050337
03/09/05 aup Changed sendActionTag 	  for ssr # 20050337 to take protocol
					  from client instead of hard coding
05/13/05 aup Changed sendActionTag	  Added try catch block for cross domain
					  permission denied error while
					  accessing location object.
*/

function sendActionTag( tagName )
{
	var atdmtUrlSuffix = "//switch.atdmt.com/action/"
	try
	{
	    var arrayLength = 3;
	    var validHostnames = new Array( arrayLength );
	    validHostnames[0] = "hollandamerica";
	    validHostnames[1] = "1n262";
	    validHostnames[2] = "webstage";

	    var myHostname = location.hostname.toLowerCase();
	    var hostProtocol = location.protocol;

	    var atdmtUrl = hostProtocol + atdmtUrlSuffix;
	    var imgUrl = atdmtUrl + tagName;

	    for ( var i = 0; i < arrayLength; i++ )
	    {
		if ( myHostname.indexOf( validHostnames[i] ) != -1 )
		{
		   document.write('<img class="tagmargin" border="0" height="1" width="1" src="' + imgUrl + '">');
		   break;
		}
	    }
	}
	catch(e)
	{
		var tempImgUrl = "http:" + atdmtUrlSuffix + tagName;
		document.write('<img class="tagmargin" border="0" height="1" width="1" src="' + tempImgUrl + '">');
	}
}


function sendActionTagOnClick( tagName, divTagId )
{ 

    var arrayLength = 3;
    var validHostnames = new Array( arrayLength );
    validHostnames[0] = "hollandamerica";
    validHostnames[1] = "1n262";
    validHostnames[2] = "webstage";

    var myHostname = location.hostname.toLowerCase();
    var hostProtocol = location.protocol;
    
    var atdmtUrl = hostProtocol + "//switch.atdmt.com/action/";
    var imgUrl = atdmtUrl + tagName;
    var divVar = "";

    for ( var i = 0; i < arrayLength; i++ )
    {
        if ( myHostname.indexOf( validHostnames[i] ) != -1 )
        {
            divVar = document.getElementById(divTagId);
	    divVar.innerHTML = '<img class="tagmargin" border="0" height="1" width="1" src="'+ imgUrl + '">';
            break;
        }
    }
  
}
//-->

