/* infradox javascript */
/* v4 MW 28 feb 2006 */

var ThisPage=0;
var PageCount=0;
var PageLoaded=0;
var TopLoaded=0;
var ThisPageType='';
var AdvancedSearchBox=false;

var now = new Date();
var se = now.getSeconds();

isMac = (navigator.appVersion.indexOf("Mac")!=-1)?true:false;
NS4 = (document.layers)?true:false;
NS6 = (!document.layers) && (navigator.userAgent.indexOf('Netscape')!=-1)?true:false;

function Submit() {
	return;
}

function checkEnter(e,action) {
	if(e && e.which) { //if which property of event object is supported (NN4)
		e = e;
		characterCode = e.which; //character code is contained in NN4's which property
	} else {
		if(window.event) e = event;
		characterCode = e.keyCode; //character code is contained in IE's keyCode property
	}

	if(characterCode == 13) { //if generated character code is equal to ascii 13 (if enter key)
		eval(action);
		return false;
	} else{
		return true 
	}
}


function SetNewSe() {
	var newnow = new Date();
	se = newnow.getSeconds();
}

function DisplayRestriction(ir, sid) {
	RestrictionWindow=window.open(dllName+"go?a=disp&pt=1&t=winrestrictions.html&si="+sid+"&ir="+ir+"&se="+se, "RestrictionWindow", 'toolbar=0,status=0,menubar=0,scrollbars=1,resizable=1,width=500,height=400');
	RestrictionWindow.focus();
}

function SetThisPage(Number) {
	ThisPage=Number;
}

function GetThisPage() {
	return ThisPage;
}

function SetPageCount(Number) {
	PageCount=Number;
}

function GetPageCount() {
	return PageCount;
}

function OpenWin(Loc, Options) {
	wMessageWindow=window.open(Loc, "wMessageWindow", Options);
	wMessageWindow.focus();
}

function PostForm(postval) {
	document.mainform.ih.value=postval;
	document.mainform.submit();
}

function isEmail(string) {
	var At=false; var Dot=false;
	if (!string) return false;
	var iChars = "*|,\":<>[]{}`\';()&$#%";

	for (var i = 0; i < string.length; i++) {
		if (iChars.indexOf(string.charAt(i)) != -1)  return false;
	}
	for (var i = 0; i < string.length; i++) {
		if (string.charAt(i) == '@')  At=true;
		if (string.charAt(i) == '.')  Dot=true;
	}
	if (At&&Dot) return true;
	return false;
}  

function isProper(string) {
	if (!string) return false;
	var iChars = "*|,\":<>[]{}`\';()@&$#%";

	for (var i = 0; i < string.length; i++) {
		if (iChars.indexOf(string.charAt(i)) != -1) return false;
	}
	return true;
}


function SelectIndexByValue(Obj,Value) {
	// lookup by value to select proper item (required for netscape)
	var Match=false;
	for (var i = 0; i<Obj.length; i++) {
		if(Obj[i].value==Value) {
			Obj.options[i].selected=true; Match=true; break;
		}
 	}
	if(!Match&&Obj.length>0) {
		if(Obj.length==2) {
			Obj.options[1].selected=true;
		} else {
			Obj.options[0].selected=true;
		}
	}
}

// textarea.inc

function validatetextarealength(what, count, errormsg,truncate,object) {
    if (what.length > count) {
        alert(errormsg);
        if (truncate) object.value=object.value.substring(1, count);

        return false;
    }
    return true;
}

// strings-js

function GetUrlName(name) {
	name=space20(trim(name));
	name=replace(name,'\'','\\\'');
	name=replace(name,'&','%26');
	return name;
}

function GetAsUrlPath(url) {
	url=replace(url,'\\','___');
	url=replace(url,'&','__');
	return url;
}

function trim(strText) { 
	// this will get rid of leading spaces 
	while (strText.substring(0,1) == ' ') 
		strText = strText.substring(1, strText.length);
	// this will get rid of trailing spaces 
	while (strText.substring(strText.length-1,strText.length) == ' ')
		strText = strText.substring(0, strText.length-1);
	return strText;
}

function replace(string,text,by) {
	var strLength = string.length, txtLength = text.length;
	if ((strLength == 0) || (txtLength == 0)) return string;

	var i = string.indexOf(text);
	if ((!i) && (text != string.substring(0,txtLength))) return string;
	if (i == -1) return string;

	var newstr = string.substring(0,i) + by;
	if (i+txtLength < strLength)
		newstr += replace(string.substring(i+txtLength,strLength),text,by);
	return newstr;
}

function CountCharInString(string, chartocount) {
	var count=0;
	for(var i=0;i<string.length;i++)	
		if(string.charAt(i) == chartocount) count++;
	return count;
}

function StripString(string) {
	for (var i=0, output='', valid='123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; i<string.length; i++)
		if (valid.indexOf(string.charAt(i)) != -1)
			output += string.charAt(i)
	return output;
}

function space20(value) {
	return replace(value,' ','%20');
}

function FindInString(string, find) {
	var strLength = string.length, findLength = find.length;
	if ((strLength == 0) || (findLength == 0)) return false;

	var found = false;
	string = string.toUpperCase();
	find = find.toUpperCase();
	
	found = (string.indexOf(find)>=0);
	return found;
}


// end strings-js


// fitwin.inc
function ResizeWin() {
	var width;
	var height;
	if (navigator.platform == "Win32" ) {
		//PC
		if (navigator.appName.indexOf("Internet Explorer") > 0) {
			width = document.images["zoomimage"].width + 38;
			height = document.images["zoomimage"].height + 60;
		} else {	
			width = document.images["zoomimage"].width+10;
			height = document.images["zoomimage"].height + 30;
		}	
	} else {
		//Mac
		if (navigator.appName.indexOf("Internet Explorer") > 0) {
			width = document.images["zoomimage"].width+30;
			height = document.images["zoomimage"].height + 40;
		} else {	
			width = document.images["zoomimage"].width + 10;
			height = document.images["zoomimage"].height + 30;
		}	
	}	

	if(height>screen.height) { 
		height=screen.height-30;
		window.resizeTo(width, height)
		window.moveTo((screen.width - width) / 2, 10);
	} else {
		window.resizeTo(width, height)
		window.moveTo((screen.width - width) / 2, (screen.height - height) / 2 - 20);
	}

}	

// begin math

function round (n, d) {
	n = n - 0; // force number
	if (d == null) d = 2;
	var f = Math.pow(10, d);
	n += Math.pow(10, - (d + 1)); // round first
	n = Math.round(n * f) / f;
	n += Math.pow(10, - (d + 1)); // and again
	n += ''; // force string
	return d == 0 ? n.substring(0, n.indexOf('.')) :
		n.substring(0, n.indexOf('.') + d + 1);
}

// end math

// menu //

function TopMenuName(index) {
	var Name = MenuItems[index][0];
	return Name.toLowerCase();
}

function SetMenuIndex(MenuIndex, SubMenuIndex, GetBreadCrumb, AddTrailing, AsLink) {
	var BreadCrumb='';
	CurrentMenuIndex = MenuIndex;
	CurrentSubMenuIndex = SubMenuIndex;
	if(GetBreadCrumb) {
		if(MenuIndex > -1) {
			BreadCrumb = MenuItems[MenuIndex][0];
			if(SubMenuIndex>0) {
				if(AsLink) {
					BreadCrumb = BreadCrumb + '&nbsp;/&nbsp;<a href="javascript:BackTo();">' + MenuItems[MenuIndex][SubMenuIndex]+'</a>';
				} else {
					BreadCrumb = BreadCrumb + '&nbsp;/&nbsp;' + MenuItems[MenuIndex][SubMenuIndex];
				}
			}
		}
		if(AddTrailing) BreadCrumb = BreadCrumb + '&nbsp;/&nbsp;';
	}
	return BreadCrumb;
}

// menu //

// months.inc

function GetMonthName(month) {
	return Months[month-1];
}

//


function WriteUseDetails(FieldIndex, Value) {
	if(Value!='') document.write(OrderUseFields[FieldIndex]+':&nbsp;'+Value+'<br>');
}

function WinPreview(imageid, objectname) {
	InfoWindow=window.open(dllName+"go?a=disp&pt=1&t=winpreview.html&rsw=1&si="+sessid+"&ir="+imageid+"&hidenav=1&se="+se, "InfoWindow", 'toolbar=0,status=0,menubar=0,scrollbars=1,resizable=1,width=500,height=600');
	InfoWindow.focus();
}

/* territories */

function TerritoryName(id) {
	for(var i=0; i<TerritoryCount; i++) {
		if(arrTerritory[i].id==id) {
			return arrTerritory[i].name;
			break;
		}
	}
}

var arrTerritory=new Array();
var TerritoryCount=0;

function ATerritory(id,name) {
	this.id=id;
	this.name=name;
}

function AddTerritory(id,name) {
	arrTerritory[TerritoryCount++]=new ATerritory(id,name);
}

AddTerritory(204, 'Albania');
AddTerritory(203, 'Algeria');
AddTerritory(202, 'American Samoa');
AddTerritory(201, 'Andorra');
AddTerritory(200, 'Angola');
AddTerritory(199, 'Argentina');
AddTerritory(198, 'Armenia');
AddTerritory(197, 'Aruba');
AddTerritory(196, 'Ascension Island');
AddTerritory(195, 'Australia');
AddTerritory(194, 'Austria');
AddTerritory(193, 'Azerbaijan');
AddTerritory(192, 'Bahamas');
AddTerritory(191, 'Bahrain');
AddTerritory(190, 'Bangladesh');
AddTerritory(189, 'Barbados');
AddTerritory(188, 'Belarus');
AddTerritory(187, 'Belgium');
AddTerritory(186, 'Belize');
AddTerritory(185, 'Benin');
AddTerritory(184, 'Bermuda');
AddTerritory(183, 'Bhutan');
AddTerritory(182, 'Bolivia');
AddTerritory(181, 'Bosnia/herzegovina');
AddTerritory(180, 'Botswana');
AddTerritory(179, 'Brazil');
AddTerritory(178, 'Brunei');
AddTerritory(177, 'Bulgaria');
AddTerritory(176, 'Burkina faso');
AddTerritory(175, 'Burundi');
AddTerritory(174, 'Cameroon');
AddTerritory(20, 'Canada');
AddTerritory(173, 'Cape verde islands');
AddTerritory(172, 'Central African rep.');
AddTerritory(171, 'Chad');
AddTerritory(170, 'Chile');
AddTerritory(169, 'China (peoples rep.)');
AddTerritory(168, 'China (taiwan)');
AddTerritory(167, 'Colombia');
AddTerritory(166, 'Comm of indep states');
AddTerritory(165, 'Comoros');
AddTerritory(164, 'Congo');
AddTerritory(163, 'Cook islands');
AddTerritory(162, 'Costa rica');
AddTerritory(161, 'Croatia');
AddTerritory(160, 'Cyprus');
AddTerritory(159, 'Czechoslovakia');
AddTerritory(158, 'Denmark');
AddTerritory(157, 'Djibouti');
AddTerritory(156, 'Ecuador');
AddTerritory(155, 'Egypt');
AddTerritory(154, 'El salvador');
AddTerritory(153, 'Equatorial guinea');
AddTerritory(152, 'Estonia');
AddTerritory(151, 'Ethiopia');
AddTerritory(150, 'Fiji');
AddTerritory(149, 'Finland');
AddTerritory(21, 'France');
AddTerritory(148, 'French antilles');
AddTerritory(147, 'French guiana');
AddTerritory(146, 'French polynesia');
AddTerritory(145, 'Gabon');
AddTerritory(144, 'Gambia');
AddTerritory(143, 'Georgia');
AddTerritory(142, 'Germany');
AddTerritory(141, 'Ghana');
AddTerritory(140, 'Gibraltar');
AddTerritory(139, 'Greece');
AddTerritory(138, 'Greenland');
AddTerritory(137, 'Guadeloupe');
AddTerritory(136, 'Guam');
AddTerritory(135, 'Guantanamo bay');
AddTerritory(134, 'Guatemala');
AddTerritory(133, 'Guyana');
AddTerritory(132, 'Haiti');
AddTerritory(131, 'Honduras');
AddTerritory(130, 'Hong kong');
AddTerritory(129, 'Hungary');
AddTerritory(128, 'Iceland');
AddTerritory(127, 'India');
AddTerritory(126, 'Indonesia');
AddTerritory(125, 'Iran');
AddTerritory(124, 'Iraq');
AddTerritory(123, 'Ireland');
AddTerritory(122, 'Israel');
AddTerritory(121, 'Italy');
AddTerritory(120, 'Ivory coast');
AddTerritory(119, 'Jamaica');
AddTerritory(118, 'Japan');
AddTerritory(117, 'Jordan');
AddTerritory(116, 'Kazakhstan');
AddTerritory(115, 'Kenya');
AddTerritory(114, 'Korea (south)');
AddTerritory(113, 'Kuwait');
AddTerritory(112, 'Latvia');
AddTerritory(111, 'Lesotho');
AddTerritory(110, 'Liberia');
AddTerritory(109, 'Libya');
AddTerritory(108, 'Liechtenstein');
AddTerritory(107, 'Lithuania');
AddTerritory(106, 'Luxembourg');
AddTerritory(105, 'Macao');
AddTerritory(104, 'Madagascar');
AddTerritory(103, 'Malawi');
AddTerritory(102, 'Malaysia');
AddTerritory(101, 'Maldives');
AddTerritory(100, 'Mali');
AddTerritory(99, 'Malta');
AddTerritory(98, 'Mauritania');
AddTerritory(97, 'Mauritius');
AddTerritory(96, 'Mexico');
AddTerritory(95, 'Moldova');
AddTerritory(94, 'Monaco');
AddTerritory(93, 'Morocco');
AddTerritory(92, 'Mozambique');
AddTerritory(91, 'Namibi');
AddTerritory(90, 'Nauru');
AddTerritory(89, 'Nepal');
AddTerritory(27, 'Netherlands');
AddTerritory(88, 'Netherlands antilles');
AddTerritory(87, 'New caledonia');
AddTerritory(86, 'New zealand');
AddTerritory(85, 'Nicaragua');
AddTerritory(84, 'Niger republic');
AddTerritory(83, 'Nigeria');
AddTerritory(82, 'Norway');
AddTerritory(81, 'Oman');
AddTerritory(80, 'Pakistan');
AddTerritory(79, 'Palua');
AddTerritory(78, 'Panama');
AddTerritory(77, 'Papua new guinea');
AddTerritory(76, 'Paraguay');
AddTerritory(75, 'Peru');
AddTerritory(74, 'Philippines');
AddTerritory(73, 'Poland');
AddTerritory(72, 'Portugal');
AddTerritory(71, 'Qatar');
AddTerritory(70, 'Reunion island');
AddTerritory(69, 'Romania');
AddTerritory(68, 'Rwanda');
AddTerritory(67, 'Saipan');
AddTerritory(66, 'San marino');
AddTerritory(65, 'Saudi arabia');
AddTerritory(64, 'Senegal');
AddTerritory(63, 'Sierra leone');
AddTerritory(62, 'Singapore');
AddTerritory(61, 'Slovenia');
AddTerritory(60, 'South africa');
AddTerritory(59, 'Spain');
AddTerritory(58, 'Sri lanka');
AddTerritory(57, 'St pierre & miquelon');
AddTerritory(56, 'St. helena');
AddTerritory(55, 'Suriname');
AddTerritory(54, 'Swaziland');
AddTerritory(53, 'Sweden');
AddTerritory(52, 'Switzerland');
AddTerritory(51, 'Syria');
AddTerritory(50, 'Tahiti');
AddTerritory(49, 'Taiwan');
AddTerritory(48, 'Tajikistan');
AddTerritory(47, 'Tanzania');
AddTerritory(46, 'Thailand');
AddTerritory(45, 'Togo');
AddTerritory(44, 'Tunisia');
AddTerritory(43, 'Turkey');
AddTerritory(42, 'Turkmenistan');
AddTerritory(41, 'Uganda');
AddTerritory(40, 'Ukraine');
AddTerritory(39, 'United arab emirates');
AddTerritory(18, 'United Kingdom');
AddTerritory(19, 'United States');
AddTerritory(38, 'Uruguay');
AddTerritory(36, 'Uzbekistan');
AddTerritory(35, 'Vatican city');
AddTerritory(34, 'Venezuela');
AddTerritory(33, 'Vietnam');
AddTerritory(32, 'Yemen');
AddTerritory(31, 'Yugoslavia');
AddTerritory(30, 'Zaire');
AddTerritory(29, 'Zambia');
AddTerritory(28, 'Zimbabwe');

