cwidth = document.documentElement.clientWidth-25;
cwidth = (cwidth  < 775) ? 775 : cwidth+5;
lwidth = cwidth-580;
entersite = true;
entered = false;
subscribed = false;

function resetContent(obj){
	obj.value = "";
}

function setDefaults(){
	cwidth = document.documentElement.clientWidth;
	cwidth = (cwidth  < 775) ? 775 : cwidth;
	lwidth = cwidth-580;
}

function startSubscription(){
	doc = document.getElementById('enterform');
	doc.action = 'subscription.php'; 
	doc.submit();
}

function enterSite(){
	doc = document.getElementById('enterform');
	doc.action = '/enter.php'+window.location.hash; 
	doc.submit();
}

function performcommand(type){
	switch(type){
		case "subscribe": startSubscription(); break;
		case "enter": enterSite(); break;
	}
}

function relocation(){
	window.location = settinglink;	
}

function printEnter(){
	ttxt = "";
	ttxt +=		'<div style = "clear:both; padding-top:10px;">';
	ttxt +=			'<div style = "margin-left:10px; clear:both; height:25px;">';
	ttxt += 				'<img src = "http://s3.amazonaws.com/ldimages/arrr.gif" style = "padding-top:5px; float:left">';
	ttxt +=				'<input id = "username" name = "username" type = "text" style = "width:160px; float:left;" value = "USERNAME" onclick = "resetContent(this)"/>';
	ttxt +=			'</div>';
	ttxt +=			'<div style = "margin-left:10px; margin-top:30px; clear:both; height:25px;">';
	ttxt += 				'<img src = "http://s3.amazonaws.com/ldimages/arrr.gif" style = "padding-top:5px; float:left">';
	ttxt +=				'<input id = "password" name = "password" type = "password" style = "width:160px; float:left;" value = "PASSWORD" onclick = "resetContent(this)"/>';
	ttxt +=			'</div>';
	ttxt +=			'<div style = "margin-left:8px; margin-top:70px; clear:both; height:25px;">';
	ttxt +=				'<div style = "width:190px; height:50px; background-image:url(\''+landingbutton+'\')" onclick = "performcommand(\'enter\')"/></div>';
	ttxt +=			'</div>';
	ttxt +=			'<div style = "color:#0099cc; text-decoration:underline; margin-top:70px; width:100%; text-align:center; "><div style = "margin-left:17px; font-size:10px;  color:#000099; " onclick = "relocation()">Forgot your ID or password?</div></div>';
	ttxt +=		'</div>';
	return ttxt;
}

function printLeft(){
	ctxt = "";
	cpage = "";
	cpage =	printEnter();
	
	ctxt += '<div style = "clear:both; width:'+cwidth+'px; float:left; height:450px; background-image:url(\''+landingfade+'\');">';
	ctxt += 	'<div style = "width:'+lwidth+'px; height:450px; float:left; text-align:center; ">';
	ctxt +=		'<div style = "width:'+lwidth+'px; height:130px; clear:both; float:left; background-image:url(\''+landinglogo+'\'); background-repeat:no-repeat;"></div>';
	ctxt +=		'<div id = "esub" style = "margin:0px auto; text-align:left; color:#444; width:200px; height:320px; clear:both; background-repeat:no-repeat;">';
	ctxt +=			cpage;
	ctxt +=		'</div>';
	ctxt += 	'</div>';
	ctxt += 	'<img src = "'+landingimg+'" id = "ldimg" style = "width:575px; height:450px; float:right;">';
	ctxt +=	'</div>';
	return ctxt;
}

function resize(){
	container = document.getElementById('maincontainer');	
	setDefaults();
	curtxt = printLeft();
	container.style.width = cwidth+'px';
	container.innerHTML = curtxt;
}

function printSite(){
	txt =	'<body style ="overflow:auto"><form id = "enterform" name = "enterform" action = ""  method="post" style = "float:left;">';
	txt += 		'<div id = "maincontainer" style = "width:'+cwidth+'px; height: auto;">';
	txt +=			printLeft();
	txt +=		'</div>';
	txt +=	'</form></body>';
	return txt;
}

ctxt = printSite();
document.write(ctxt);
window.onresize = resize; 