var xmlHttp;
var poll;
var tRef = "";


function UseShip(scdID,scdSName){
	document.getElementById("popupTripData_shipname").innerText = scdSName;
}



function InsertSWF(objID,objFilename,objW,objH){
	document.write("<object id='" + objID + "' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='" + objW + "' height='" + objH + "'>");
	document.write("<param name='movie' value='swf/" + objFilename + "' />");
	document.write("<param name='quality' value='high' />");
	document.write("<param name='wmode' value='transparent' />");
	document.write("<embed src='swf/" + objFilename + "' wmode='transparent' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='" + objW + "' height='" + objH + "'></embed>");
	document.write("</object>");
}



function PollForTicketStatus(thisRef){
	tRef = thisRef;
	clearInterval(poll);
	poll = setInterval(DoPoll,2000);
}


function DoPoll(){
	try{
		xmlHttp=new XMLHttpRequest();
	}
	catch (e){  // Internet Explorer
		try{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e){
		    try{      
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e){
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState==4){
			var array = xmlHttp.responseText.split("~");
			ticketCode = array[0];
			ticketName = array[1];
			ticketEmail = array[2];
			ticketContact = array[3];
			
			//if(document.getElementById("data_name")) document.getElementById("data_name").innerText = ticketName;
			//if(document.getElementById("data_email")) document.getElementById("data_email").innerText = ticketEmail;
			//if(document.getElementById("data_contact")) document.getElementById("data_contact").innerText = ticketContact;
			//if(document.getElementById("div_nodata")) document.getElementById("div_nodata").style.display = "none";
			
			switch(ticketCode){
				case "10":
					//document.getElementById("imageProcessing").style.display = "none";
					//document.getElementById("imagePaid").style.display = "block";
					//document.getElementById("imageCancelled").style.display = "none";
					clearInterval(poll);
				break;
				case "99":
					//document.getElementById("imageProcessing").style.display = "none";
					//document.getElementById("imageCancelled").style.display = "block";
					//document.getElementById("imagePaid").style.display = "none";
					clearInterval(poll);
				break;
			}
		}
	}
	xmlHttp.open("GET","_checkTicketStatus.aspx?ref=" + tRef,true);
	xmlHttp.send(null);
}


/*
   Milonic Flash Activation Script - insert_active_flash.js version 1.1 - October 3 2008

   Copyright 2005 (c) Milonic Solutions Limited. All Rights Reserved.
   This is a commercial software product, please visit http://www.milonic.com/ for more information.
*/

function commitFlashObject(_obj, _container, thisID){
	var _output=_paramoutput=_src=_ver="";
	for(var _cO in _obj){
		_output+=_cO+"=\""+_obj[_cO]+"\" "
		_paramoutput+="<param name="+_cO+" value=\""+_obj[_cO]+"\">";
		if(_cO=="movie")_src="src=\""+_obj[_cO]+"\"";
		if(_cO=="version")_ver=_obj[_cO];
	}
	if(_ver=="")_ver="8,0,0,0"
	var ihtm="<object id=\"" + thisID + "\" classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 codebase="+location.protocol+"//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="+_ver+" "+_output+">\n"
	ihtm+=_paramoutput+"\n"
	ihtm+="<embed "+_src+" pluginspage="+location.protocol+"//www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash type=application/x-shockwave-flash "+_output+">\n";
	ihtm+="</embed>\n";
	ihtm+="</object>\n";
	document.getElementById(_container).innerHTML=ihtm
}