
ie5=(document.getElementById&&document.all&&document.styleSheets)?1:0;

nn6=(document.getElementById&&!document.all)?1:0;

promptWidth=330;
promptHeight=200;
xPromptStart=500;
yPromptStart=300;
promptTitle="<p align='center'><b>Подписка на новости</b></p>";
promptText="<p align='center'>Введите свой email</p>";

function okPrompt() {

	var email = document.promptform.promptinput.value;
	emailTest = "^[_\\.0-9a-z-]+@([0-9a-z][0-9a-z_-]+\\.)+[a-z]{2,4}$"; 
	var regex = new RegExp(emailTest); 
	
	if (!regex.test(email) || !(email.length > 0)){
		alert("Введите правильный адрес");
		return false;
	}else{
		window.open(Site+"subscribe.php?email="+email);
		document.getElementById("prompt").style.top=-500;
	}
		document.promptform.promptinput.select();
}
function abortPrompt() {
	document.getElementById("prompt").style.top=-500;
	document.promptform.promptinput.value=""; 
}
function promptAlternative() {
	alert("Извините ваш браузер не поддерживает скрипты");
}
			
		


if(ie5||nn6) {
	
	if(ie5) cs=2,th=30;
	else cs=0,th=20;
	//wg. Layout

	document.write(
		"<div style='position:absolute;top:-500;left:0;z-index:100' id='prompt'>"+
			"<table style='border-style:outset;border-width:2;border-color:#000000;background-color:#FFFFFF' cellpadding='5' cellspacing='"+cs+"' width='"+promptWidth+"' height='"+promptHeight+"' onmousemove='movePrompt()' onmouseup='moveStatus=0'>"+
				"<tr><td height='"+th+"' bgcolor='#DEDBCC'>"+promptTitle+"</td></tr>"+
				"<tr><td><br>"+promptText+"</td></tr>"+
				"<tr align='center'><td>"+
					"<br>"+
					"<form name='promptform' onsubmit='okPrompt();return false'><input style='background-color:#DEDBCC;border-width:1' type='text' size='35' value='' name='promptinput'>"+
						"<br><br><br>"+
						"<input style='background-color:#DEDBCC;border-width:1;font-weight:bold' type='button' value='&nbsp; &nbsp; OK &nbsp; &nbsp;' onclick='okPrompt()' onfocus='if(this.blur)this.blur()'>"+
						"&nbsp;&nbsp;"+
						"<input style='background-color:#DEDBCC;border-width:1;font-weight:bold' type='button' value='Отмена' onclick='abortPrompt()' onfocus='if(this.blur)this.blur()'>"+
					"</form>"+
				"</td></tr>"+
			"</table>"+
		"</div>"
	);

}


//Box anzeigen

function showPrompt() {
	
	if(ie5||nn6) {
		
		moveStatus=0;

		xPrompt=xPromptStart, yPrompt=yPromptStart;

		if(ie5) {
			document.getElementById("prompt").style.left=xPrompt+document.body.scrollLeft;
			document.getElementById("prompt").style.top=yPrompt+document.body.scrollTop;
		}

		else if(nn6) {
			document.getElementById("prompt").style.left=xPrompt+window.pageXOffset;
			document.getElementById("prompt").style.top=yPrompt+window.pageYOffset;
		}

		document.promptform.promptinput.focus();

	}

	else promptAlternative();

}


//Relative Mausposition ermitteln

var xRelativ, yRelativ;

function getxyRelativ() {

	moveStatus=1;

	if(ie5) {

		xRelativ=event.clientX-xPrompt;

		yRelativ=event.clientY-yPrompt;

	}

}


//Box bewegen (nur IE)

function movePrompt() {

	if(ie5&&moveStatus>0) {

		xPrompt=document.getElementById("prompt").style.left=event.clientX+document.body.scrollLeft-xRelativ;

		yPrompt=document.getElementById("prompt").style.top=event.clientY+document.body.scrollTop-yRelativ;

	}

}