//+--------------------------------+
//              Login              |
//+--------------------------------+ 

var loginform_visible = false;
var firstTime = true;
var loginform_shadow_thickness = 6;
var loginform_width = 300;
var loginform_height = 200;
var layer_width = loginform_width + loginform_shadow_thickness;
var layer_height = loginform_height + loginform_shadow_thickness;
var _l = 0;
var _t = 0;

function setPositionLayer(el_name) {
	_l = (document.body.clientWidth/2)-(layer_width/2);
	_t = (document.body.clientHeight/2)-(layer_height/2);

	if (_l<0) {
		_l = 0;
	}
	if (_t<0) {
		_t = 0;
	}
	element = document.getElementById(el_name);
	element.style.left = _l;
	element.style.top = _t;
	return;
}

function showLayer(element_name) {
	if (firstTime == true) {
		firstTime = false;
		setPositionLayer(element_name);
	}
	else {
		element = document.getElementById(element_name);
		if (loginform_visible == false) {
			_l = (document.body.clientWidth/2)-(layer_width/2);
			_t = (document.body.clientHeight/2)-(layer_height/2);
			if (_l<0) {
				_l = 0;
			}
			if (_t<0) {
				_t = 0;
			}
			element.style.left = _l;
			element.style.top = _t;
			document.getElementById('LoginForm_shadow_bottom').style.visibility = 'visible';
			document.getElementById('LoginForm_shadow_corner').style.visibility = 'visible';
			
			//loginform_visible = true;
		}
		else {
			element.style.left = (-1)*(loginform_width-1);
			element.style.top = (-1)*(loginform_height-1);
			document.getElementById('LoginForm_shadow_bottom').style.visibility = 'hidden';
			document.getElementById('LoginForm_shadow_corner').style.visibility = 'hidden';
			
			//loginform_visible = false;
		}
	}
//----------------------------	
	if (loginform_visible == false) {
		loginform_visible = true;
		document.instance_loginbutton.src = "buttons/closebuttonactiv.gif";
		//window.alert("loginform_visible= "+loginform_visible);
	}
	else {
		loginform_visible = false;
		document.instance_loginbutton.src = "buttons/loginbuttonactiv.gif";
		//window.alert("loginform_visible= "+loginform_visible);
	}
//----------------------------
}

function loginbuttonOver(){
	if (loginform_visible == false) {
		document.instance_loginbutton.src="buttons/loginbuttonactiv.gif";
	}
	else {
		document.instance_loginbutton.src="buttons/closebuttonactiv.gif";
	} 
}

function loginbuttonUp() {
	if (loginform_visible == false) {
		document.instance_loginbutton.src="buttons/loginbutton.gif";
	}
	else {
		document.instance_loginbutton.src="buttons/closebutton.gif";
	}
}


function createLoginform() {
	document.write('<DIV id="LoginForm" style="visibility:visible;width:'+(layer_width)+';height:'+(layer_height)+';position:absolute;top: -400;left:0;z-index:2;">');
	document.write('<TABLE WIDTH="'+(layer_width)+'px" HEIGHT="'+(layer_height)+'px" CELLPADDING="0" CELLSPACING="0" BORDR="0">');
	document.write('<TR>');
	document.write('<TD COLSPAN="2" ROWSPAN="2" WIDTH="'+(loginform_width)+'px" HEIGHT="'+(loginform_height)+'px">');
	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ID="log" WIDTH="'+(loginform_width)+'px" HEIGHT="'+(loginform_height)+'px">');
	document.write('<PARAM NAME="movie" VALUE="loginform.swf">');
	document.write('<PARAM NAME="quality" VALUE="high">');
	document.write('<PARAM NAME="wmode" VALUE="transparent">');
	document.write('<PARAM NAME="bgcolor" VALUE="#FFFFFF">');
	document.write('<EMBED src="loginform.swf" quality=high wmode=transparent bgcolor="#FFFFFF"  WIDTH="'+(loginform_width)+'px" HEIGHT="'+(loginform_height)+'px" swLiveConnect=true ID="log" NAME="log_layer" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>');
	document.write('</TD>');
	document.write('<TD WIDTH="'+(loginform_shadow_thickness)+'px" HEIGHT="'+(loginform_shadow_thickness)+'px">');
	document.write('<IMG SRC="bgimages/spacer1px.gif" BORDER="0">');
	document.write('</TD>');
	document.write('</TR>');
	document.write('<TR>');
	document.write('<TD WIDTH="'+(loginform_shadow_thickness)+'px" HEIGHT="'+(loginform_height-loginform_shadow_thickness)+'px" VALIGN="TOP">');
	document.write('<DIV id="LoginForm_shadow_right" style="visibility: visible; position: relative; width: '+(loginform_shadow_thickness)+'px; height: '+(loginform_height-loginform_shadow_thickness)+'px;">');
	if (_IE) {
		document.write('<EMBED NAME="loginformshadow_w6h194" SRC="shadows/loginformshadow_w6h194.svg" WIDTH="6px" HEIGHT="194px" PLUGINSPAGE="http://www.adobe.com/svg/viewer/install/" TYPE="image/svg-xml" WMODE="transparent"></EMBED>');
	}
	else {
		document.write('<IMG SRC="shadows/loginformshadow_w6h194.png" BORDER="0">');
	}
	document.write('</DIV>');
	document.write('</TD>');
	document.write('</TR>');
	
	document.write('<TR>');
	document.write('<TD WIDTH="'+(loginform_shadow_thickness)+'px" HEIGHT="'+(loginform_shadow_thickness)+'px">');
	document.write('<IMG SRC="bgimages/spacer1px.gif" BORDER="0">');
	document.write('</TD>');
	document.write('<TD WIDTH="'+(loginform_width-loginform_shadow_thickness)+'px" HEIGHT="'+(loginform_shadow_thickness)+'px">');
	document.write('<DIV id="LoginForm_shadow_bottom" style="visibility: visible; position: relative; width: '+(loginform_width-loginform_shadow_thickness)+'px; height: '+(loginform_shadow_thickness)+'px;">');
	if (_IE) {
		document.write('<EMBED NAME="loginformshadow_w294h6" SRC="shadows/loginformshadow_w294h6.svg" WIDTH="294px" HEIGHT="6px" PLUGINSPAGE="http://www.adobe.com/svg/viewer/install/" TYPE="image/svg-xml" WMODE="transparent"></EMBED>');
	}
	else {
		document.write('<IMG SRC="shadows/loginformshadow_w294h6.png" BORDER="0">');
	}
	document.write('</DIV>');
	document.write('</TD>');
	document.write('<TD WIDTH="'+(loginform_shadow_thickness)+'px" HEIGHT="'+(loginform_shadow_thickness)+'px">');
	document.write('<DIV id="LoginForm_shadow_corner" style="visibility: visible; position: relative; width: '+(loginform_shadow_thickness)+'px; height: '+(loginform_shadow_thickness)+'px;">');
	if (_IE) {
		document.write('<EMBED NAME="loginformshadow_w6h6" SRC="shadows/loginformshadow_w6h6.svg" WIDTH="6px" HEIGHT="6px" PLUGINSPAGE="http://www.adobe.com/svg/viewer/install/" TYPE="image/svg-xml" WMODE="transparent"></EMBED>');
	}
	else {
		document.write('<IMG SRC="shadows/loginformshadow_w6h6.png" BORDER="0">');
	}
	document.write('</DIV>');
	document.write('</TD>');
	document.write('</TABLE>');
	document.write('</DIV>');
}