

function GetElementById(id){
	if (document.getElementById) {
		return (document.getElementById(id));
	} else if (document.all) {
		return (document.all[id]);
	} else {
		if ((navigator.appname.indexOf("Netscape") != -1) && parseInt(navigator.appversion == 4)) {
			return (document.layers[id]);
		}
		
	}
}


function drawWay() {
	
	obj_caption=GetElementById('page_name');
	obj_caption2=GetElementById('page_name2');
		
	if (obj_caption2.value!='') {
		if (obj_caption.innerHTML!=obj_caption2.value) {
			caption2= '<a id="way_link2" href="#">'+obj_caption.innerHTML+'</a>';
			caption3='&nbsp;|&nbsp;<span id="way_link3" class="breadcrumb_sel">'+obj_caption2.value+'</span>';
			}
		else {
			caption2=' <span id="way_link3" class="breadcrumb_sel">'+obj_caption.innerHTML+'</span>';
			caption3='';
			}

		
		}
	else {
		caption2=' <span id="way_link3" class="breadcrumb_sel">'+obj_caption.innerHTML+'</span>';
		caption3='';
		}
	
	obj=GetElementById('way_text');
	inText='<a id="way_link1"  href="index.php">Главная</a>&nbsp;|&nbsp;'+caption2+caption3;
	
	obj.innerHTML=inText; 
}

function setLang(obj) {	
	
	location.href=obj.value;
}

function  openPrintPage(url, width, height) { 
	html_content=GetElementById('page_general_content').innerHTML;
	//alert(html_content);
		
	var pattern = /\r\n|\r|\n/g;
	var html_content = html_content.replace(pattern,"");		
	                           
	var pattern = /\<\!\-\-calendarsetupstart\-\-\>(.*)\<\!\-\-calendarsetupend\-\-\>/;
	var html_content = html_content.replace(pattern,'<table><tr><td><input style="width:70" name="date_time_start" id="date_time_start" ></td><td><img style="cursor:pointer" id="button_calculator_start" src="img/cal_Open.gif"></td></tr></table>');
	
	var pattern = /\<\!\-\-calendarsetupstart2\-\-\>(.*)\<\!\-\-calendarsetupend2\-\-\>/;
	var html_content = html_content.replace(pattern,'<table><tr><td><input style="width:70" name="date_time_end" id="date_time_end" ></td><td><img style="cursor:pointer" id="button_calculator_end" src="img/cal_Open.gif"></td></tr></table>');
	
	var pattern = /\<\!\-\-calendarsetupstart3\-\-\>(.*)\<\!\-\-calendarsetupend3\-\-\>/;
	var html_content = html_content.replace(pattern,"");
	
		
	var  width=900;
 	var height=600; 
      NewWin= open("",  "displayWindow", "width="+width+",height="+height+",status=no,toolbar=no,scrollbars=yes, resizable=yes, menubar=no");
      //NewWin.document.close();
   	  NewWin.focus();
   	  
 // открыть объект document для последующей печати 
  NewWin.document.open();
  
   // генерировать новый документ 
NewWin.document.write('<html><head><title>Andreas Neocleous & Co LLC</title>');
NewWin.document.write('<meta name="description" content=""><meta name="keywords" content=""><meta name="author" content="BDigital Web Solutions"><meta name="copyright" content="Copyright © 2009, Andreas Neocleous & Co LLC"><meta http-equiv="Content-Language" content="en-us">');
NewWin.document.write('<LINK href="style.css" type=text/css rel=stylesheet>');


NewWin.document.write('<script src="js/lib.js" type="text/javascript"></script>');

NewWin.document.write('<body leftmargin="0" topmargin="0" bgcolor="FFFFFF" onLoad="window.print();">');
NewWin.document.write('<a name="top"></a>');
NewWin.document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0" class="PrintPage">');
NewWin.document.write('	<tr>');
NewWin.document.write('		<td width="10" nowrap></td>');
NewWin.document.write('		<td valign="top">');
NewWin.document.write('			<table width="100%" border="0" cellspacing="0" cellpadding="0">');
NewWin.document.write('				<tr>');
NewWin.document.write('					<td><img src="img/popup_logo.gif"></td>');
NewWin.document.write('					<td width="10" nowrap></td>');
NewWin.document.write('					<td width="100%" bgcolor="E5E5E5" align="right" valign="top">');
NewWin.document.write('						<table height="20" border="0" cellspacing="0" cellpadding="0">');
NewWin.document.write('							<tr>');
NewWin.document.write('								<td width="8" valign="bottom" nowrap> </td>');
NewWin.document.write('								<td width="1" valign="bottom" nowrap bgcolor="#FFFFFF"> </td>');
NewWin.document.write('								<td width="8" valign="bottom" nowrap> </td>');
NewWin.document.write('								<td valign="bottom" class="toptext"><a href="javascript:top.print()">Print</a></td>');
NewWin.document.write('								<td width="8" valign="bottom" nowrap> </td>');
NewWin.document.write('								<td width="1" valign="bottom" nowrap bgcolor="#FFFFFF"> </td>');
NewWin.document.write('								<td width="8" valign="bottom" nowrap> </td>');
NewWin.document.write('								<td valign="bottom" class="toptext"><a href="javascript:window.close()">Close</a></td>');
NewWin.document.write('								<td width="8" valign="bottom" nowrap> </td>');
NewWin.document.write('							</tr>');
NewWin.document.write('						</table>');
NewWin.document.write('					</td>');
NewWin.document.write('				</tr>');
NewWin.document.write('			</table>');
NewWin.document.write('		</td>');
NewWin.document.write('		<td width="10" nowrap></td>');
NewWin.document.write('	</tr>');
NewWin.document.write('	<tr>');
NewWin.document.write('	  <td height="10" colspan="3"></td>');
NewWin.document.write('	</tr>');
NewWin.document.write('	<tr>');
NewWin.document.write('		<td width="10" nowrap></td>');
NewWin.document.write('		<td width="100%" valign="top">');
NewWin.document.write('		  <table width="100%" border="0" cellspacing="0" cellpadding="0">');
NewWin.document.write('				<tr>');
NewWin.document.write('					<td width="100%">');
NewWin.document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0" class="StandardPage">');
NewWin.document.write('  <tr>');
NewWin.document.write('    <td height="8"></td>');
NewWin.document.write('  </tr>');
NewWin.document.write('  <tr>');
NewWin.document.write('<tr>');
NewWin.document.write('    <td>');
    
    
NewWin.document.write(html_content);    

    
NewWin.document.write('</td>');
NewWin.document.write('  </tr>');
NewWin.document.write('</table>');
NewWin.document.write('    </td>');
NewWin.document.write('    <td width="10" nowrap></td>');
NewWin.document.write('  </tr>');
NewWin.document.write('</table>');
NewWin.document.write('</body>');
NewWin.document.write('</html>');

  // закрыть документ - (но не окно!)
  NewWin.document.close();  
     	  
}



function  openEmailPage() { 
		
	var  width=500;
 	var height=300; 
     NewWin= open("",  "displayWindow", "width="+width+",height="+height+",status=no,toolbar=no,scrollbars=yes, resizable=yes, menubar=no");      
   	 NewWin.focus();
   	  
 // открыть объект document для последующей печати 
  NewWin.document.open();
  
   // генерировать новый документ 
//NewWin.document.write('<html><head><title>Andreas Neocleous & Co LLC</title>');


NewWin.document.write('<html><head><title>Email page to a friend</title><meta name="description" content="">');
NewWin.document.write('<meta name="keywords" content=""><meta name="author" content="BDigital Web Solutions">');
NewWin.document.write('<meta name="copyright" content="Copyright © 2009, Andreas Neocleous & Co LLC">');
//NewWin.document.write('<META http-equiv=Content-Type content="text/html; charset=windows-1251">');
//NewWin.document.write('<meta http-equiv="Content-Type" content="text/html; charset=utf-8">');

NewWin.document.write('<LINK href="style.css" type=text/css rel=stylesheet>');
//NewWin.document.write('<script src="js/lib.js" type="text/javascript"></script>');
NewWin.document.write('</head>');
NewWin.document.write('<body leftmargin="0" topmargin="0"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="EmailPage"><tr><td width="10" nowrap></td>');
NewWin.document.write('<script >function ValidateEmailPageForm (form) {  var name = form.name.value;     var email = form.email.value;     var fname1 = form.fname1.value;     var femail1 = form.femail1.value;     if (!name)	{    alert("Вы должны ввести ваше имя.9");    return false;  } else if (!email)	{    alert("Вы должны ввести ваш email.");    return false;	} else if ((email.indexOf(\'@\') == -1) || (email.indexOf(\'.\') == -1)) {		alert("Неправильный формат email.");		return false;  } else if (!fname1)	{    alert("Вы должны ввести имя вашего друга.");    return false;  } else if (!femail1)	{    alert("Вы должны ввести email вашего друга.");    return false;	} else if ((femail1.indexOf(\'@\') == -1) || (femail1.indexOf(\'.\') == -1)) {		alert("Неправильный формат email.");		return false;	} else {		return true;	}} function goToThanks() {lochref = \'thanks.php\';location = lochref;}</script>');
NewWin.document.write('<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">');
NewWin.document.write('<tr><td><img src="img/popup_logo.gif"></td><td width="10" nowrap></td><td width="100%" bgcolor="E5E5E5" align="right" valign="top">');
NewWin.document.write('<table height="20" border="0" cellspacing="0" cellpadding="0">');
NewWin.document.write('<tr><td width="1" valign="bottom" nowrap bgcolor="#FFFFFF"> </td><td width="8" valign="bottom" nowrap> </td>');
NewWin.document.write('<td valign="bottom" class="toptext"><a href="javascript:window.close()">Close</a></td><td width="8" valign="bottom" nowrap> </td></tr></table></td>');
NewWin.document.write('</tr></table></td><td width="10" nowrap></td></tr><tr><td height="10" colspan="3"></td></tr><tr>');
NewWin.document.write('<td width="10" nowrap></td><td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td valign="top">');
NewWin.document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0">');
NewWin.document.write('<tr><td><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td valign="top"> ');
NewWin.document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td  class="header" width="100%">Отправить эту страницу по эл. почте</td></tr></table></td>');
NewWin.document.write('</tr><tr><td height="10" valign="top"> </td></tr><tr><td height="1" background="img/dotline_hor_bg.gif"> </td>');
NewWin.document.write('</tr><tr><td height="4" valign="top"> </td></tr><tr><td valign="top"><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0">');
NewWin.document.write('<TR><TD WIDTH="100%" height="10" class="pagelink"> ');
NewWin.document.write('Страница: '+location.href+'</TD>');
NewWin.document.write('</TR></TABLE></td></tr><tr><td height="4" valign="top"> </td>');
NewWin.document.write('</tr><tr><td height="1" background="img/dotline_hor_bg.gif"> </td></tr><tr><td height="5" valign="top"> </td></tr><tr> ');
NewWin.document.write('<td valign="top"><table width="100%" border="0" cellpadding="3" cellspacing="0"><tr> ');
NewWin.document.write('<td valign="top"><FORM ACTION="thanks.php" METHOD="POST" onSubmit="return ValidateEmailPageForm(this)">');
NewWin.document.write('<input type="hidden" name="pagelink" value="'+location.href+'">');

NewWin.document.write('<TABLE width="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0"><TR> ');
NewWin.document.write('<TD WIDTH="100%"> <TABLE WIDTH="100%" BORDER="0" CELLSPACING="1" CELLPADDING="2"><TR><TD WIDTH="50%" class="pagelabels" align="center"> Ваше Имя</TD><TD WIDTH="50%" class="pagelabels" align="center"> ');
NewWin.document.write('Ваш адрес эл. почты</TD></TR><TR> <TD align="center"> <INPUT NAME="name" TYPE="text" SIZE="25"></TD><TD align="center"><INPUT NAME="email" TYPE="text" SIZE="25"></TD></TR>');
NewWin.document.write('</TABLE></TD></TR></TABLE><TABLE width="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0">');
NewWin.document.write('<TR> <TD WIDTH="100%"> <TABLE WIDTH="100%" BORDER="0" CELLSPACING="1" CELLPADDING="2">');
NewWin.document.write('<TR> <TD WIDTH="50%" class="pagelabels" align="center"> Имя друга</TD>');
NewWin.document.write('<TD WIDTH="50%" class="pagelabels" align="center"> Адрес эл. почты друга</TD></TR><TR>');
NewWin.document.write('<TD WIDTH="50%" align="center"><INPUT NAME="fname1" TYPE="text" SIZE="25"></TD>');
NewWin.document.write('<TD WIDTH="50%" align="center"><INPUT NAME="femail1" TYPE="text" SIZE="25"></TD></TR> <TR>');
NewWin.document.write('<TD WIDTH="50%" align="center"><INPUT NAME="fname2" TYPE="text" SIZE="25"></TD><TD WIDTH="50%" align="center">');
NewWin.document.write('<INPUT NAME="femail2" TYPE="text" SIZE="25"></TD></TR> <TR>');
NewWin.document.write('<TD WIDTH="50%" align="center"><INPUT NAME="fname3" TYPE="text" SIZE="25"></TD>');
NewWin.document.write('<TD WIDTH="50%" align="center"><INPUT NAME="femail3" TYPE="text" SIZE="25"></TD> ');
NewWin.document.write('</TR><TR> <TD height="5" colspan="2" align="center" valign="top"> ');
NewWin.document.write('</TD></TR><TR><TD colspan="2" align="center"><INPUT NAME="submitbtn" TYPE="submit" VALUE="Послать" class="formbutton" style="width:100px;"><input name="resetbtn" type="reset" value="Очистить Анкету" class="formbutton" style="width:100px;">');
NewWin.document.write('</TD></TR></TABLE></TD></TR></TABLE><INPUT NAME="submitform" TYPE="hidden" VALUE="EmailForm">');
NewWin.document.write('</FORM></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td><td width="10" nowrap></td></tr></table></body></html>');






}
function ValidateEmailPageForm (form) { // Used in Give us your feedback page (pageid=5&ctype=bm)
  var name = form.name.value;   
  var email = form.email.value;   
  var fname1 = form.fname1.value;   
  var femail1 = form.femail1.value;   
	
  if (!name)	{
    alert("Вы должны ввести ваше имя.9");
    return false;
  } else if (!email)	{
    alert("Вы должны ввести ваш email.");
    return false;
	} else if ((email.indexOf('@') == -1) || (email.indexOf('.') == -1)) {
		alert("Неправильный формат email.");
		return false;
  } else if (!fname1)	{
    alert("Вы должны ввести имя вашего друга.");
    return false;
  } else if (!femail1)	{
    alert("Вы должны ввести email вашего друга.");
    return false;
	} else if ((femail1.indexOf('@') == -1) || (femail1.indexOf('.') == -1)) {
		alert("Неправильный формат email.");
		return false;
	} else {
		return true;
	}
}


/*
function ValidateEmailPageForm (form) { // Used in Give us your feedback page (pageid=5&ctype=bm)
  var name = form.name.value;   
  var email = form.email.value;   
  var fname1 = form.fname1.value;   
  var femail1 = form.femail1.value;   
	
  if (!name)	{
    alert("You must enter your name.");
    return false;
  } else if (!email)	{
    alert("You must enter your email.");
    return false;
	} else if ((email.indexOf('@') == -1) || (email.indexOf('.') == -1)) {
		alert("Wrong email format.");
		return false;
  } else if (!fname1)	{
    alert("You must enter the name of at least one friend.");
    return false;
  } else if (!femail1)	{
    alert("You must enter the email of at least one friend.");
    return false;
	} else if ((femail1.indexOf('@') == -1) || (femail1.indexOf('.') == -1)) {
		alert("Wrong email format.");
		return false;
	} else {
		return true;
	}
}
*/


