// Java Document

<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function getX(obj) {
	var cleft = 0;
	if(obj.offsetParent) {
		while(1) {
			cleft += obj.offsetLeft;
			if(!obj.offsetParent) break;
			obj = obj.offsetParent;
		}
	} else if(obj.x) {
		cleft += obj.x;
	}
	return cleft;
}

function getY(obj) {
	var ctop = 0;
	if(obj.offsetParent) {
		while(1) {
			ctop += obj.offsetTop;
			if(!obj.offsetParent) break;
			obj = obj.offsetParent;
		}
	} else if(obj.y) {
		ctop += obj.y;
	}
	return ctop;
}

function getPageSizeWithScroll(){
	if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = document.body.offsetHeight;
		xWithScroll = window.innerWidth + window.scrollMaxX - 17;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight;
		xWithScroll = document.body.offsetWidth;
  	}
	arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
	//alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll );
	return arrayPageSizeWithScroll;
}

function setBlinderBackgroundSize() {
	objw = document.getElementById('winBlinder');

	objw.style.width = '100%';
	objw.style.height = '100%';
	
	setTimeout( "var getPageSizeWithScroll_string = getPageSizeWithScroll(); document.getElementById('winBlinder').style.width = getPageSizeWithScroll_string[0]+'px'", 500 );
	setTimeout( "var getPageSizeWithScroll_string = getPageSizeWithScroll(); document.getElementById('winBlinder').style.height = getPageSizeWithScroll_string[1]+'px'", 500 );
}

function winRezAction() {
	obj = document.getElementById('winLogin');
	obj.style.top = getY(document.getElementById('bttnLogin')) - 10;
	obj.style.left = getX(document.getElementById('bttnLogin')) - 192;

	setBlinderBackgroundSize();

	obj2 = document.getElementById('winSignup');
	obj2.style.top = getY(document.getElementById('bttnSignup')) - 10;
	obj2.style.left = getX(document.getElementById('bttnSignup')) - 140;
	//obj2.style.left = "440px";
}

function showLogin() {
	obj = parent.document.getElementById('winLogin');

	if (obj.style.display == '') {
		obj.style.display = 'none';
	} else {
		obj.style.top = getY(document.getElementById('bttnLogin')) - 10;
		obj.style.left = getX(document.getElementById('bttnLogin')) - 192;

		obj.style.display = '';
		
		document.frmLoginWindow.name.focus();
	}
}

function showSignup() {
	obj1 = document.getElementById('winBlinder');
	obj2 = document.getElementById('winSignup');

	if (obj1.style.display == '') {
		blConfirm = confirm('Are you sure you want to close the signup window?\nAll the information you have entered will be lost.');
		
		if (blConfirm) obj1.style.display = 'none';
	} else {
		setBlinderBackgroundSize();

		if (navigator.appName.indexOf ("Microsoft") !=-1) {
			document.getElementById('background').Play();
		}
		
		obj2.style.top = getY(document.getElementById('bttnSignup')) - 10;
		obj2.style.left = getX(document.getElementById('bttnSignup')) - 140;
		//obj2.style.left = "440px";
		
		obj1.style.display = '';

		var myiframe=document.getElementById("singupPages");
		myiframe.src = "/i_signup_page1.asp";
	}
}

var set1;
var set2;

var set11;
var set21;

var set12;
var set22;

var set13;
var set23;

var set14;
var set24;



function showSignupPopup(action) {
	spobj = document.getElementById('winSignupPopups1');
	spobj1 = document.getElementById('winSignupPopups2');
	spobj2 = document.getElementById('winSignupPopups3');
	spobj3 = document.getElementById('winSignupPopups4');
	spobj4 = document.getElementById('winSignupPopups5');
	
	if (action == "close") {
		spobj.style.display = 'none';
		spobj1.style.display = 'none';
		spobj2.style.display = 'none';
		spobj3.style.display = 'none';
		spobj4.style.display = 'none';
	} else {
		//var rand_no = Math.ceil(Math.random() * 5);

	//	document.getElementById('popupImage').src = '/images/popup_signup1.gif';
	//	document.getElementById('popupImage1').src = '/images/popup_signup2.gif';
	//	document.getElementById('popupImage').src = '/images/popup_signup3.gif';
	//	document.getElementById('popupImage').src = '/images/popup_signup4.gif';
	//	document.getElementById('popupImage').src = '/images/popup_signup5.gif';

	//	switch(rand_no) {
	//		case 1:
				spobj.style.top = getY(document.getElementById('bttnSignup')) - 30;
				spobj.style.left = getX(document.getElementById('bttnSignup')) - 169;
 	//			break;
	//		case 2:
				spobj1.style.top = getY(document.getElementById('bttnSignup')) - 79;
				spobj1.style.left = getX(document.getElementById('bttnSignup')) - 1;
	//			break;
	//		case 3:
				spobj2.style.top = getY(document.getElementById('bttnSignup')) - 42;
				spobj2.style.left = getX(document.getElementById('bttnSignup')) + 114;
	//			break;
	//		case 4:
				spobj3.style.top = getY(document.getElementById('bttnSignup')) + 37;
				spobj3.style.left = getX(document.getElementById('bttnSignup')) + 74;
	//			break;
	//		case 5:
				spobj4.style.top = getY(document.getElementById('bttnSignup')) + 47;
				spobj4.style.left = getX(document.getElementById('bttnSignup')) - 83;
	//			break;
	//	}

	//	clearTimeout(set1);
	//	clearTimeout(set2);

		set1 = setTimeout ( "spobj.style.display = ''" ,50 );
		set2 = setTimeout ( "spobj.style.display = 'none'" ,5000 );
		
		set11 = setTimeout ( "spobj1.style.display = ''" ,50 );
		set21 = setTimeout ( "spobj1.style.display = 'none'" ,5000 );
		
		set12 = setTimeout ( "spobj2.style.display = ''" ,50 );
		set22 = setTimeout ( "spobj2.style.display = 'none'" ,5000 );
		
		set13 = setTimeout ( "spobj3.style.display = ''" ,50 );
		set23 = setTimeout ( "spobj3.style.display = 'none'" ,5000 );
		
		set14 = setTimeout ( "spobj4.style.display = ''" ,50 );
		set24 = setTimeout ( "spobj4.style.display = 'none'" ,5000 );
		
		
		
	}
}

function openppl(app,tlb,mnu,wdt,hei){
	window.open('/nm/' + app,'','toolbar=' + tlb +',location=0,status=1,menubar=' + mnu +',scrollbars=1,resizable=1,width=' + wdt + ',height=' + hei);
}

//Function to open pop up window
function winOpener(theURL, winName, scrollbars, resizable, width, height) {
	
	winFeatures = 'left=' + (screen.availWidth-10-width)/2 + ',top=' + (screen.availHeight-30-height)/2 + ',scrollbars=' + scrollbars + ',resizable=' + resizable + ',width=' + width + ',height=' + height + ',toolbar=0,location=0,status=1,menubar=0'
  	window.open(theURL, winName, winFeatures);
}

function searchCategory (id) {
	var url = "/cboSubCategory.asp?oper=subcategory";
	var params = "id="+id;
	
	var ajax = new Ajax.Request(url,  
	{ 	method: 'post',  
		parameters: params,
		onComplete: function(res) { 
			var objCombo = $("subcategory");
			objCombo.options.length = 0;
			eval(res.responseText);
		}
	});
}

//-->