//---------- BLOCK DATA ----------------
it_str=" "; win=null;
sline="______________________________________";
max_len=400;
mask_s="1^*T^7";
mas0=["Presenting Author","E-mail","Alternative email","Fax "
     ];
mas1=["Title of the Abstract","Authors","Affiliation","Text of Abstract"];
//------------------------------------------------------
function itog()
{
str="<center style='font-size:18px;font-weight:bold;'>CHECK YOUR REGISTRATION FORM AND PRESS THE &quot;CLICK HERE TO SUBMIT YOUR ABSTRACT&quot; BUTTON BELOW<br>";
str+="THE FORM IS NOT SAVED UNTILL YOU PRESS THE BUTTON</center><br>";
str+="<table border=0 cellpadding=7 style='font-size:14px;font-family: courier new,arial;'>";
pt=document.forms[0];
// COMMON INFO
st="document.forms[0].f";
for(i=0;i<4;i++)
{
 str+="<tr>";
 ft=eval(st+i);
 if(i == 2 || i == 8){
  str+="<td><b>"+mas0[i]+" :</b></td><td>"+ft.value+"</td>";
 }
 else {
  txt=ft.value;
  if(i != 3 && i != 10){if(txt.length<2 || txt=="  "){window.alert("Data in '"+mas0[i]+"' is missing");return;} }
  str+="<td><b>"+mas0[i]+" :</b></td><td>"+txt+"</td>";
 }
 str+="</tr>";
}
ns_stype=true;
for(i=0;i<2;i++) if(pt.f12[i].checked) {ns_stype=false; break;}
if(ns_stype) {window.alert("Data in 'type of presentation' is missing");return;}
//---------
for(i=0;i<4;i++) if(pt.f12[i].checked){str+="<tr><td><b>"+"Category"+" :</b></td><td>"+pt.f12[i].value+"</td></tr>";break;}
str+="</table><br>"+sline+"<br><br>";
// ABSTRACT
str+="<table border=0 width=700 cellpadding=7 style='font-size:13px;font-family: courier new,arial;'>";
    // Title
tx=pt.txt0.value;
if(tx.length<2 || tx=="  "){window.alert("Data in '"+mas1[0]+"' is missing");return;}
if(tx.length>max_len)tx=tx.substring(0,max_len);
str+="<tr><td valign='top'><b>"+mas1[0]+"</b></td><td valign='top'><pre>"+tx+"</pre><br>"+sline+"<br></td></tr>";
    // Authors
tx=pt.txt1.value;
if(tx.length<2 || tx=="  "){window.alert("Data in '"+mas1[1]+"' is missing");return;}
if(tx.length>max_len)tx=tx.substring(0,max_len);
str+="<tr><td valign='top'><b>"+mas1[1]+"</b></td><td valign='top'><pre>"+tx+"</pre><br>"+sline+"<br></td></tr>";
    // Affiliation
tx=pt.txt2.value;
if(tx.length<2 || tx=="  "){window.alert("Data in '"+mas1[2]+"' is missing");return;}
if(tx.length>max_len)tx=tx.substring(0,max_len);
str+="<tr><td valign='top'><b>"+mas1[2]+"</b></td><td valign='top'><pre>"+tx+"</pre><br>"+sline+"<br></td></tr>";
    // Text of Abstract
tx=pt.txt3.value;
if(tx.length<20){window.alert("Data in '"+mas1[3]+"' is missing");return;}
if(tx.length>2500){window.alert("Maximal length of your abstract should not exceed 2500 characters with spaces.");return;}
str+="<tr><td valign='top'><b>"+mas1[3]+"</b></td><td valign='top'><pre>"+tx+"</pre><br>"+sline+"<br></td></tr>";
str+="</table>";
//-----
it_str=str;
it_doc="<body>"+str;
it_doc+="<form action='ta_1009/script/tezis.php' method='post'>";
it_doc+="<input type='hidden' name='p0'><input type='hidden' name='p1'>";
it_doc+="<input type='hidden' name='p2'><input type='hidden' name='p3'>";
it_doc+="<input type='hidden' name='p4'>";
it_doc+="<input type='hidden' name='p5'><input type='hidden' name='p6'>";
it_doc+="<input type='hidden' name='p7'><br><br>";
it_doc+="<center><input type='button' style='font-size:20px;' value='CLICK HERE TO SUBMIT YOUR ABSTRACT' onclick='opener.subm2();'></form></center><br><br>";
it_doc+="</body>";
cl_win();
win=open("","subm","width=790,height=480,menubar,scrollbars");win.document.write(it_doc);
}
//-----------------------------------
function subm2()
{
pt=document.forms[0];
e_mail=pt.f1.value; fam=pt.f0.value;
fid="f"+Math.round(Math.random()*999)+"_"+Math.round(Math.random()*980);
t_tezis=pt.txt0.value;
//firstn=pt.f1.value; 
form_of=0;
for(i=0;i<2;i++) if(pt.f12[i].checked){form_of=i;break;}
//country=pt.f8.value;
//----
pt2=win.document.forms[0];
pt2.p0.value=e_mail;
pt2.p1.value=fam;
pt2.p2.value=it_str;
pt2.p3.value=fid;
pt2.p4.value=t_tezis;
//pt2.p5.value=firstn;
pt2.p6.value=form_of;
//pt2.p7.value=country;
pt2.submit();
}
//-----------------------------------
function cl_win()
{
try{
win.close();
}catch(ex){}
}
//-----------------------------------
function count_sym()
{
pt=document.forms[0];
pt.csym.value=" "+(pt.txt3.value).length;
}
//-----------------------------------
function storeCaret(textEl) {
	if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}
//-----------------------------------
function sput(tx) {
    abt=document.forms[0].txt3;
	if (abt.createTextRange && abt.caretPos) {
		var caretPos = abt.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? tx + ' ' : tx;
		//caretPos.text = caretPos.text.charAt(caretPos.text.length-1);
		abt.focus();
	} else {
	abt.value +=tx;
	abt.focus();
	}
}
//----------------------------------
