function el(id){
		if (document.getElementById) {
			return document.getElementById(''+id+'');
		}
		if (document.layers) {
			return document.layers[''+id+''];
		}
		if (document.all) {
			return document.all[''+id+''];
		}
}

//var IE4 = (document.all) ? 1 : 0;
var scIE=((navigator.appName == "Microsoft Internet Explorer") );
var scNN=((navigator.appName == "Netscape")&&(document.layers));

function makeArray() {
    for (i = 0; i<makeArray.arguments.length; i++)
        this[i + 1] = makeArray.arguments[i];
}
function y2k(number) { return (number < 1000) ? number + 1900 : number; }

var months = new makeArray('January','February','March','April','May','June','July','August','September','October','November','December');
var today = new Date();
var date  = today.getDate();
if (date  < 9) date = "0" + date;
var month = today.getMonth() + 1;
var year  = y2k(today.getYear());
var today_str =months[month] + ' ' + date  + ' ' + year;


var mandatoryFields = new Array;
var mandatoryFieldsDescr = new Array;
function addMandatoryField(fieldName, fieldDescr, mand) {
    if (mand==0) return;
	mandatoryFields[mandatoryFields.length]=fieldName;
	mandatoryFieldsDescr[mandatoryFieldsDescr.length]=fieldDescr;
}

function submitFeedBack() {
	for ( i=0; i<mandatoryFields.length; i++ ) {
		inp = 'document.forms[0].'+mandatoryFields[i];
		inp1=eval(inp);
		if (inp1.value.length==0) {
	        alert("Field "+mandatoryFieldsDescr[i]+' cannot be empty')
	        inp1.focus();
			return false;

		}
	}
	return true;
}

function getRandom(number) {
	return Math.ceil(Math.random()*number);
}

var visible = false;
var curr_popup = "";
btnName = "pp-start";
var scX = 200;
var scY = 100;

function hide(i) {
	visible = false;
	domlay('popup_'+i,0,scX ,scY);
}

function show(i, callObj) {
	var butName = 'pp-start_'+i;
	if (curr_popup != "" && curr_popup != i) {
		hide(curr_popup);
	}
	curr_popup = i;

	if ( scIE ) {
		scX = getOffsetLeft(document.images[butName])-152;
		scY = getOffsetTop(document.images[butName])+1;
	}
	else {
		scX = document.images[butName].x - 157;
		scY = document.images[butName].y + 24;
	}
	visible=true;
	domlay('popup_' + i ,1,scX ,scY);
}

function getOffsetLeft (el) {
	var ol = el.offsetLeft;
	while ((el = el.offsetParent) != null)
		ol += el.offsetLeft;
	return ol;
}

function getOffsetTop (el) {
	var ot = el.offsetTop;
	while((el = el.offsetParent) != null)
		ot += el.offsetTop;
	return ot;
}

function domlay(id,trigger,lax,lay,content) {
	// Layer visible
	if (trigger=="1"){
		el(id).style.visibility = "visible";
		el(id).style.display="block";
	}
	// Layer hidden
	else if (trigger=="0") {
		el(id).style.visibility = "hidden";
		el(id).style.display="none";
	}

	// Set horizontal position
	if (lax){
		if (document.layers){document.layers[''+id+''].left = lax}
		if (document.getElementById){document.getElementById(''+id+'').style.left=lax+"px"}
		if (document.all){document.all[''+id+''].style.left=lax}
		}
	// Set vertical position
	if (lay){
		if (document.layers){document.layers[''+id+''].top = lay}
		if (document.getElementById){document.getElementById(''+id+'').style.top=lay+"px"}
		if (document.all){document.all[''+id+''].style.top=lay}
		}
	// change content

	if (content){
	if (document.getElementById){
		rng = document.createRange();
		el = document.getElementById(''+id+'');
		rng.setStartBefore(el);
		htmlFrag = rng.createContextualFragment(content)
		while(el.hasChildNodes()) el.removeChild(el.lastChild);
		el.appendChild(htmlFrag);
		// end of Reyn ;)
		}
		if (document.all) document.all[''+id+''].innerHTML = content;
	}
}

function popimg (u, title) {
	var i = window.open('about:blank', 'img','toolbar=no,resizable=yes,scrollbars=yes');
	i.document.open();
	i.document.write("<table align=center cellpadding=30 style='border:1px solid #666666'>");
	i.document.write("<tr><td align=center>");
	i.document.write("<img src='" + u + "'>");
	i.document.write("</td></tr></table><br>");
	i.document.write("<center><span style='font-size:12px; font-family:Arial; color: #000000'>" + title + "</span></center>");
	i.document.close();
	i.focus();

}

function popup (id) {
	var i = window.open(id, 'popup','toolbars=0,resizable=1,status=1,scrollbars=0,width=700,height=490');
	i.focus();
}
function popupBig (id) {
	var i = window.open(id, 'popupBig','toolbars=0,resizable=1,status=1,scrollbars=0,width=700,height=490');
	i.focus();
}

function em(t , i) {
	var s = t.substring(0,i);
	var e = t.substring(i) + '.co.uk';
	document.write('<a href="mail' + 'to:' + s + '@' + e + '">' + s + '@' + e + '</a>');
}
