// ERROR POPUP //
	
	var footerpop = null;
	var calcpop = null;
		
// MAIN POPUP //
	function open_main(url)
	{
	
	LeftPosition=(screen.width)?(screen.width-730)/2:100;
	//LeftPosition=0;
	//TopPosition=0;
	TopPosition=(screen.height)?(screen.height-394)/2:100;
			
	
	window.open(url,'','scrollbars=0,menu=0,height=394,width=730,left='+LeftPosition+',top='+TopPosition);
	//window.open(url,'','scrollbars=1,menu=0,height='+(screen.availHeight-30)+',width='+(screen.availWidth-20)+',left='+LeftPosition+',top='+TopPosition);
	
	}
	
	function open_new(url)
	{	
	LeftPosition=(screen.width)?(screen.width-425)/2:100;
	TopPosition=(screen.height)?(screen.height-454)/2:100;			
	
	window.open(url,'','scrollbars=0,menu=0,height=454,width=425,left='+LeftPosition+',top='+TopPosition);
	}

	function open_upload(m, type)
	{	
	
		url = '/upload_'+type+'.php?m='+m;
	
	w = 540;
	
	if (type == 'friends')
	{
		h = 657;
	}
	else
	{
		h = 630;
	}
	
	LeftPosition=(screen.width)?(screen.width-w)/2:100;
	TopPosition=(screen.height)?(screen.height-h)/2:100;			
	
	window.open(url,'uploader','scrollbars=0,menu=0,height='+h+',width='+w+',left='+LeftPosition+',top='+TopPosition);
	}
	

	function open_window(url, winname, w, h, scroll)
	{	
	
		LeftPosition=(screen.width)?(screen.width-w)/2:100;
		TopPosition=(screen.height)?(screen.height-h)/2:100;			
		
		window.open(url,winname,'scrollbars='+scroll+',menu=0,height='+h+',width='+w+',left='+LeftPosition+',top='+TopPosition);
	}


	
// FOOTER POPUP //
	function open_footer(url) {
		var h = 322;
		var w = 436;
		LeftPosition=(screen.width)? (screen.width-w)/2: 100;
		TopPosition=(screen.height)? (screen.height-h)/2: 100;
		window.open(url,'footer','scrollbars=yes,menu=0,height='+h+',width='+w+',left='+LeftPosition+',top='+TopPosition);
	}

	
	function alerterr(msg)
	{
		centerlayer('errorLyr',313,146);
		
			html  = '<table cellpadding="0" cellspacing="0" border="0" background="images/err_bg.jpg" width="293" height="233">\n';
			html += '<tr>\n';
			html += '<td width="10"></td>\n';
			html += '<td height="40"></td>\n';
			html += '<td width="10"></td>\n';
			html += '</tr>\n';
			html += '<tr>\n';
			html += '<td width="10"></td>\n';
			html += '<td height="129" valign="top" style="padding-left:10px;padding-right:10px;">'+msg+'</td>\n';
			html += '<td width="10"></td>\n';
			html += '</tr>\n';
			html += '<tr>\n';
			html += '<td width="10"></td>\n';
			html += '<td height="50" align="center" valign="bottom"><a href="javascript://" onclick="hide(\'errorLyr\');"><img src="images/close.jpg" width="60" height="22" alt="close" border="0"></a></td>\n';
			html += '<td width="10"></td>\n';
			html += '</tr>\n';
			html += '</table>\n';	
		
		
		if(ns4 && !ns6) {
	        var status = eval(doc + '["errorLyr"]' + htm);
			status.write(html);
            status.close();
			show('errorLyr');
		} else if (ie || ns6)  {
	        var status = document.getElementById('errorLyr');
            status.innerHTML = html;
			show('errorLyr');
		}
		else
		{
			alert(msg);
		}
	}
	
		function centerlayer(layerName,w,h)
{

	obj = getObject(layerName);

	if (parseInt(navigator.appVersion)>3)
	{

		if (navigator.appName=="Netscape")
		{
			winW = window.innerWidth;
			winH = window.innerHeight;
		}

		if (navigator.appName.indexOf("Microsoft")!=-1)
		{
			winW = document.body.offsetWidth;
			winH = document.body.offsetHeight;
		}
	}

	if (w>0)
	{
		LeftPosition=(winW)?(winW-w)/2:100;
		LeftPosition = parseInt(LeftPosition);
	//	alert(LeftPosition);
		obj.left = LeftPosition+"px";
	}

	if (h>0)
	{
		TopPosition=(winH)?(winH-h)/2:100;
		TopPosition = parseInt(TopPosition);
	//	alert(TopPosition);
		obj.top = TopPosition+"px";
	}
}

	
//Browser Sniffing
var ns4=document.layers?1:0
var ie=document.all?1:0
var ns6=document.getElementById&&!document.all?1:0
var mac=navigator.userAgent.indexOf('Mac')>0?1:0;
var obj = null;	

//Hide and show layers
	if (ie||ns6)
	{
		var fShow = "visible";
		var fHide = "hidden";
	}
	else
	{
		var fShow = "show";
		var fHide = "hide";
	}	

function getObject(layerName)
{

	if (ie)
	{	
		obj = eval("document.all['"+layerName+"'].style");
	}
	else if (ns6)
	{
		obj = eval("document.getElementById('"+layerName+"').style");		
	}
	
	else
	{
		obj = eval("document.layers['"+layerName+"']");
	}
	
//	alert(layerName+' '+obj);
	
	return obj;	
	
}

// Show layers
function show(layerName)
{
		obj = getObject(layerName);
		obj.visibility=fShow;
}

// Hide layers
function hide(layerName)
{
		obj = getObject(layerName);
		obj.visibility=fHide;
}

function hideall(layerNameArray)
{

	for (x = 0; x <= layerNameArray.length-1; x++)
	{
		hide(layerNameArray[x]);
	}

}	
	
	function centerwin(obj,h,w)
	{
	
		LeftPosition=(screen.width)?(screen.width-w)/2:100;
		TopPosition=(screen.height)?(screen.height-h)/2:100;

		obj.moveTo(LeftPosition,TopPosition);
	
	}

	function setwin(obj,h,w)
	{
	
		obj.resizeTo(w,h);
		centerwin(obj,h,w);
		obj.focus();
	
	}

/*	
function Validemail(val) 
{
	var RE1 = /^[A-Za-z0-9_-]+[A-Za-z0-9_-]*@{1,1}[A-Za-z0-9_-]+[.]{1,1}\w{2,4}/;
	return RE1.test(val);
}	
*/

// Changed to include dotted localpart and dash in localpart.
function Validemail(val) 
{
	var RE1 = /^[\.A-Za-z0-9_-]+[\.A-Za-z0-9_-]*@{1,1}[A-Za-z0-9_-]+[.]{1,1}\w{2,4}/;
	return RE1.test(val);
}	


function TestNumerics(val) 
{
	var RE1 = /[\d]+/;
	return RE1.test(val);
}

function TestAlphaNumerics(val)
{
	var RE1 = /[A-Za-z ]/;
	return RE1.test(val);
}










// -- Specific Animation functions ---------------------------------------------------------------------
function doLayers(layerset, actNo)
{
//	alert(counter+' '+delay);


	switch (layerset)
	{
		// -- define layer set 1
		// -- TO DISPLAY step1 cpt
		case 1: {
			var layers = new Array();
			layers[0] = "show_topblock";		
			break;
		}
	
		default:
			return false;
	}
	
	if (counter == layers.length)
	{
		counter = 0;
		clearInterval(interval);
		return false;
	}

	layer = layers[counter];
	show(layer);

	counter++;
}

// --- vars
		var counter = 0;
		var delay = 1000;
		
function activate(level)
{
	if (level == 1)
	{
		hide('r0');
		show('r1');
		hide('r2');
		show('centercontent');
		hide('rightcontent');
		hide('doublecontent');
	}
	else if (level == 2)
	{

		hide('r0');
		hide('r1');
		show('r2');

		show('centercontent');
		show('rightcontent');
		hide('doublecontent');
	}
	else if (level == 3)
	{

		hide('r0');
		hide('r1');
		hide('r2');

		hide('centercontent');
		hide('rightcontent');
		show('doublecontent');
	}
}

	function centerit(lyr)
	{
	
		LeftPosition=(screen.width)?(screen.width-430)/2:100;
		TopPosition=(screen.height)?(screen.height-430)/2:100;

		TopPosition = TopPosition - 60;
		
		if (TopPosition < 0)
		{
			TopPosition = 20;
		}
		
		obj = getObject(lyr);
		obj.left = LeftPosition + "px";
		obj.top = TopPosition + "px";
		
		show(lyr);
	
	}
	
	function resetAll()
	{
		show('r0');
		hide('r1');
		hide('r2');
		hide('centercontent');
		hide('rightcontent');	
		hide('doublecontent');	
	}

