// Browser Detection
isMac = (navigator.appVersion.indexOf("Mac")!=-1) ? true : false;
NS4 = (document.layers) ? true : false;
IEmac = ((document.all)&&(isMac)) ? true : false;
IE4plus = (document.all) ? true : false;
IE4 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 4.")!=-1)) ? true : false;
IE5 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 5.")!=-1)) ? true : false;
ver4 = (NS4 || IE4plus) ? true : false;
NS6 = (!document.layers) && (navigator.userAgent.indexOf('Netscape')!=-1)?true:false;

// Body onload utility (supports multiple onload functions)
var gSafeOnload = new Array();
function SafeAddOnload(f)
{
	if (IEmac && IE4)  // IE 4.5 blows out on testing window.onload
	{
		window.onload = SafeOnload;
		gSafeOnload[gSafeOnload.length] = f;
	}
	else if  (window.onload)
	{
		if (window.onload != SafeOnload)
		{
			gSafeOnload[0] = window.onload;
			window.onload = SafeOnload;
		}		
		gSafeOnload[gSafeOnload.length] = f;
	}
	else
		window.onload = f;
}
function SafeOnload()
{
	for (var i=0;i<gSafeOnload.length;i++)
		gSafeOnload[i]();
}

function stripe() {
	var tables = document.getElementsByTagName("table");

	for (var j = 0; j < tables.length; j++) {
		if (tables[j].className == "zebra" || tables[j].className.indexOf("linelist") >= 0) {
			var trs = tables[j].getElementsByTagName("tr");

			for (var i = 1; i < trs.length; i += 2) {
				trs[i].className += " even";
			}
		}
	}
}

function SetFocus() {
	var control = document.getElementById(arguments[0]);
	if (control != null) {
		control.focus();
		control.select();
	}
}

function SetFocusWithoutSelect()
{
	var control = document.getElementById(arguments[0]);
	if(control != null)
	{
		control.focus();
	}
}

function WizardCancel() {
	myWindow = window.open("/template/dialogs/WizardCancel.aspx", "weeWindow", 'resizable,scrollbars,width=300,height=250');
	myWindow.opener = self;
}

function FileUploadResult(uploadedfilepath, result) {
	myWindow = window.open("/template/dialogs/FileUploadResult.aspx?filepath=" + uploadedfilepath + "&result=" + result, "weeWindow", 'resizable,scrollbars,width=400,height=250');
	myWindow.opener = self;
}

function FindClient() {
	myWindow = window.open("/template/dialogs/findclient.aspx?target=" + arguments[0], "FindClientWindow", 'resizable,scrollbars,width=500,height=350');
	myWindow.opener = self;
}

function FindStock() {
	myWindow = window.open("/template/dialogs/findstock.aspx?target=" + arguments[0], "FindVesselWindow", 'resizable,scrollbars,width=550,height=350');
	myWindow.opener = self;
}

function FindSpecies() {
	myWindow = window.open("/template/dialogs/findspecies.aspx?target=" + arguments[0], "FindVesselWindow", 'resizable,scrollbars,width=550,height=350');
	myWindow.opener = self;
}

function FindVessel() {
	myWindow = window.open("/template/dialogs/findvessel.aspx?target=" + arguments[0], "FindVesselWindow", 'resizable,scrollbars,width=650,height=350');
	myWindow.opener = self;
}

function ConvertQuotaAce() {
	myWindow = window.open("/template/dialogs/QuotaAceConverter.aspx", "FindClientWindow", 'resizable,scrollbars,width=450,height=300');
	myWindow.opener = self;
}

function CalculateDeemedValue() {
	myWindow = window.open("/template/dialogs/DeemedValueCalculator.aspx", "FindClientWindow", 'resizable,scrollbars,width=500,height=400');
	myWindow.opener = self;
}

function Reminders(type, client){
	myWindow = window.open("/template/dialogs/Reminders.aspx?type=" + type + "&client=" + client, "RemindersWizard", 'resizable,scrollbars,width=500,height=350');
	myWindow.opener = self;
}

function ContactInformation(type, commtype){
	myWindow = window.open("/template/dialogs/ContactInformation.aspx?type=" + type + "&commtype=" + commtype, "ContactInformation", 'resizable,scrollbars,width=500,height=450');
	myWindow.opener = self;
}

function ContactPersons(type, contactid){
	myWindow = window.open("/template/dialogs/ContactPersons.aspx?type=" + type + "&contactid=" + contactid, "ContactPerson", 'resizable,scrollbars,width=500,height=450');
	myWindow.opener = self;
}

function Permit(){
	myWindow = window.open("/template/dialogs/PermitApplication.aspx?panel=" +  arguments[0] + "&id=" + arguments[1], "PermitApplication", 'resizable,scrollbars,width=400,height=300');
	myWindow.opener = self;
}

function DeleteContactInformation(type, commtype){
	myWindow = window.open("/template/dialogs/ContactInformation.aspx?type=" + type + "&commtype=" + commtype, "weeWindow", 'resizable,scrollbars,width=400,height=300');
	myWindow.opener = self;
}

function DeleteContactPersons(type, contactid){
	myWindow = window.open("/template/dialogs/ContactPersons.aspx?type=" + type + "&contactid=" + contactid, "weeWindow", 'resizable,scrollbars,width=400,height=350');
	myWindow.opener = self;
}

function SigningAuthority(clientid, action, name){
	myWindow = window.open("/template/dialogs/SigningAuthority.aspx?clientid=" + clientid + "&action=" + action + "&name=" + name, "weeWindow", 'resizable,scrollbars,width=450,height=350');
	myWindow.opener = self;
}

function IncludedPerson(clientid, action){
	myWindow = window.open("/template/dialogs/IncludedPerson.aspx?clientid=" + clientid + "&action=" + action, "weeWindow", 'resizable,scrollbars,width=470,height=400');
	myWindow.opener = self;
}

function PortLocation()
{
	myWindow = window.open("/template/dialogs/PortRegionLocation.aspx?target=" + arguments[0], "PortLocationWindow", 'resizable,scrollbars,width=400,height=300');
	myWindow.opener = self;
}

function VesselOver28m(type, id, vesselid){
	myWindow = window.open("/template/dialogs/Over28mVessel.aspx?id=" + id + "&type=" + type + "&vessel=" + vesselid, "VesselOver28m", 'resizable,scrollbars,width=500,height=450');
	myWindow.opener = self;
}





SafeAddOnload(stripe);