//javascript common functions
function OpenWindow(Url, Width, Height){
	var props;
	var left=(screen.width/2)-(Width/2);
	var top=((screen.height/2)-(Height/2))-20;
	props="left=" + left + ",top=" + top + ",height=" + Height + ",width=" + Width;
	props=props + ",directories=no,status=no,toolbar=no,menubar=no,location=no,scrollbars=no,border=thin,center=1";
	return window.open(Url,"",props);
}

function OpenWindowEx(Url, Width, Height, Props){
	var left = (screen.width/2)-(Width/2);
	var top = ((screen.height/2)-(Height/2))-20;
	if (Props) Props = Props + ",";
	Props = Props + "left=" + left + ",top=" + top + ",height=" + Height + ",width=" + Width;
	Props = Props + ",toolbar=no,directories=no,menubar=no,location=no,border=thin,center=1";
	window.open(Url,"",Props);
}

function FullScreen(){
	var w = screen.availWidth||screen.width
	var h = screen.availHeight||screen.height
	window.moveTo(0,0)
	window.resizeTo(w,h)
}

function PutDate(Lang){
	var t = new Date;
	var Months = new Array('January','Ιανουαρίου', 'February','Φεβρουαρίου', 'March','Μαρτίου', 'April','Απριλίου', 'May','Μαΐου', 'June','Ιουνίου', 'July','Ιουλίου', 'August','Αυγούστου', 'September','Σεπτεμβρίου', 'October','Οκτωβρίου', 'November','Νοεβρίου', 'December','Δεκεμβρίου');
	var WeekDays = new Array('Sunday','Κυριακή','Monday','Δευτέρα', 'Tuesday','Τρίτη', 'Wednesday','Τετάρτη','Thursday','Πέμπτη','Friday','Παρασκευή','Saturday','Σάββατο');
	if (Lang == "N" ){ //GREEK
		document.write(WeekDays[1 + t.getDay() * 2] + ", " + t.getDate() + " " + Months[1 + t.getMonth() * 2] + " " + t.getFullYear());
	}else {
		document.write(WeekDays[t.getDay() * 2] + " " + Months[t.getMonth() * 2] + " " + t.getDate() + ", " + t.getFullYear());
	} return;
}

function topic(ObjName,Text) {
	document.all(ObjName).innerText=Text + "   ";
}

function InnerHtml(Id, html) {
	if(document.getElementById){ 
		document.getElementById(Id).innerHTML = html; 
	} 
}

function LogoutUser() {
	window.open('logout.asp','','');
	setTimeout('parent.close()',800);
}

function PrintDoc(){
	if (document.getElementById != null){	
		var html = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">\n';
		html += '<html>\n\n<head>\n\n';

		html += '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-7">\n';
		html += '<title>e-ΒΑΣΗ</title>';
		html += '<link href="../bin/reports.css" rel="stylesheet" type="text/css" media="screen">\n';
		html += '<link href="../bin/reports.css" rel="stylesheet" type="text/css" media="print">\n';
		html += '\n</head>\n<body>\n';
		
		
		var img = parent.topFrame.document.getElementById("rpt_img")
		if (img != null) {
			html += img.innerHTML;
		}
		
		var el = document.getElementById("header");
		if (el != null)	{
			html += '\n<p class="title">' + el.innerHTML + '</p>\n';
		}
		el = document.getElementById("class")
		if (el != null) {
			html += '\n<p style="font-weight:bold">' + el.innerText + '</p>\n';
		}
		el = document.getElementById("Print");
		if (el != null)	{
			html += el.innerHTML;
		}

		html += '\n</body>\n</html>\n';
		
		/* crate a frameset and add a toolbar at topFrame and the html at mainFrame*/
		var left = (screen.width/2)-(610/2);
		var win = window.open("","Print","width=610, height=500, left=" + left + ",top=50,resizable=yes,location=no,menubar=no,scrollbars=yes,status=no");
		win.document.open("text/html");
		win.document.write('<html>\n<head>\n<title>Print Preview</title>\n',
							'</head>\n<frameset rows="18,*" cols="*" framespacing="0" frameborder="no" border="0">\n',
    						'<frame src="../bin/toolbar.asp" name="topFrame" scrolling="NO" noresize>\n',
    						'<frame src="#" name="mainFrame">\n',
							'</frameset>\n</html>\n');
		win.document.close();			
		win.mainFrame.document.open();
		win.mainFrame.document.write(html);
		win.mainFrame.document.close();		
	}
}

function SelectionChange(Obj, url){
	document.location.href= url + "?id=" + Obj.options[Obj.selectedIndex].value
	return false;
}
