
var ns = (document.layers)? true:false
var ie = (document.all)? true:false
var dom = (document.getElementById)? true:false
var ns6 = (navigator.vendor == ("Netscape6") || navigator.product == ("Gecko"));

function getStyle() {

	if (ns) {
		this.divLen = eval(document.buffer).clip.height;
		this.bodyH = window.innerHeight;
		this.bodyW = window.innerWidth;
		}
	else {
		if (dom) {
			if (navigator.userAgent.indexOf('MSIE',0) == -1) {
				this.divLen = eval("document.getElementById('buffer').offsetHeight");
				this.bodyH = window.innerHeight;
				this.bodyW = window.innerWidth;
				}
			else {
				this.divLen = eval("document.getElementById('buffer').clientHeight");
				this.bodyH = document.body.offsetHeight;
				this.bodyW = document.body.offsetWidth;
				}
			}
		else {
			if (ie) {
				this.divLen = eval(document.all.buffer).clientHeight;
				this.bodyH = document.body.offsetHeight;
				this.bodyW = document.body.offsetWidth;				
				}
			}
		}
	}
	
function swap(img1,ref1,sts1) {
	document.images[img1].src = moDir + ref1 + ".gif";
	s(sts1);
	}
	
function position() {
	getStyle();

	var winW = this.bodyW;

	if (ie && !dom) {
		watermark.style.pixelLeft = winW/2-7;
		setTimeout('watermark.style.visibility = "visible"',50)
		}
	if (ns) {
		document.watermark.left += 30;
		setTimeout('document.watermark.visibility = "visible"', 50)
		}
	if (dom) {
		document.getElementById('watermark').style.left = winW/2-7;
		setTimeout("document.getElementById('watermark').style.visibility = 'visible';", 50)
		}
		//alert(winW);
	}
	
function moveWM() {

	getStyle();
	
	var topPos = 0;
	var bufferTop = parseInt(this.divLen)+72;
	var winH = this.bodyH;
	
	if (ie && !dom) {
		topPos = document.body.scrollTop+winH-150;
		if(bufferTop < topPos){
			watermark.style.pixelTop = topPos;
			}
		else {
			watermark.style.pixelTop = bufferTop;
			}
		}
	else if (dom) {

		topPos = ns6?pageYOffset+winH-90:document.body.scrollTop+winH-150;

		if(bufferTop < topPos){
			document.getElementById('watermark').style.top = topPos+'px';
			}
		else {
			document.getElementById('watermark').style.top = bufferTop+'px';
			}
		}
	else {
		topPos = eval(window.pageYOffset+winH-150);
		if(bufferTop < topPos){
			eval(document.watermark.top = topPos);
			}
		else {
			eval(document.watermark.top = bufferTop);
			}
		}
	}
//________________________________________________________
function setHeight(top){
	getStyle();
	
	var winH = this.bodyH;
	
	document.getElementById('main').style.height = winH - 164 + 'px';
	
	if(top=='noback')return 1;
	
	hei=winH-370;
	if(top!='top') path='../';
	else path='';
	document.getElementById('bod').style.background = 'url('+path+'common/images/pad.gif) no-repeat  fixed 40px '+hei+'px';
}
//________________________________________________________
function setPaddings(top){
	getStyle();
	
	var winH = this.bodyH;
	
	if(winH>600){
		document.getElementById('buffer2').style.height = 15 + 'px';
		document.getElementById('buffer3').style.height = 30 + 'px';
	}
}
//________________________________________________________
function popUp(url,wd,ht) {
	window.open(url,'temp','height='+ht+',width='+wd+',toolbar=0,directories=0,menubar=0,status=0,resizable=1,location=0,scrollbars=0,copyhistory=0');
	}

function popMisc(url,wd,ht) {
	var miscwin = window.open(url,'misc','height='+ht+',width='+wd+',toolbar=0,directories=0,menubar=0,status=0,resizable=1,location=0,scrollbars=1,copyhistory=0');
	}
function popUpJB() {

	var topX, leftY;
	
	if (document.all)
	    topX =  0, leftY = screen.width -280;
	else if (document.layers)
	  	topX =  0, leftY = screen.width -280;

	win = window.open('/jukebox.asp','jbwin','height=30,width=155,toolbar=0,directories=0,menubar=0,status=0,resizable=0,location=0,scrollbars=0,copyhistory=0,screenX='+topX+',screenY='+leftY+',top='+topX+',left='+leftY);
	}

function isblank(s) {
    for(var i = 0; i < s.length; i++) {
        var c = s.charAt(i);
        if ((c != ' ') && (c != '\n') && (c != '\t')) return false;
    }
    return true;
}

function verify(f) {
    var msg;
    var empty_fields = "";
    var errors = "";
	
	window.alert('aaa');

    for(var i = 0; i < f.length; i++) {
        var e = f.elements[i];
        if (((e.type == "text") || (e.type == "textarea")) && !e.optional) {
            // first check if the field is empty
            if ((e.value == null) || (e.value == "") || isblank(e.value)) {
				tempName = e.name;
				str = tempName.replace("_"," ")
				empty_fields += "\n          " + str;
                continue;
            }
			if (e.name == "Email") { 
				if (e.value.indexOf ('@',0) == -1 || e.value.indexOf ('.',0) == -1){      
					errors += "- Please format your email address correctly.";      
				} 
			}
        }
    }


    if (!empty_fields && !errors) return true;

    msg  = "______________________________________________________\n\n"
    msg += "The form was NOT submitted due to the following error(s).\n";
    msg += "Please correct the error(s) and re-submit.\n";
    msg += "______________________________________________________\n\n"

    if (empty_fields) {
        msg += "- The following required field(s) are empty:" 
                + empty_fields + "\n";
        if (errors) msg += "\n";
    }
    msg += errors;
    alert(msg);
    return false;
}


