var agent	= navigator.platform;
var browser = navigator.appName;
var version = parseInt(navigator.appVersion); 
//window.alert('version :' + version);
//window.alert('Broswer :' + browser);
//window.alert('Platform :' + agent);

//var browser = navigator.appName;
//var version = parseInt(navigator.appVersion); 



if (browser == "Netscape" && version >= 4) version = 'n4';
else if (browser == "Netscape" && version == 3) version = 'n3';
else if (browser == "Netscape" && version == 2) version = 'n2';
else if (browser == "Netscape" && version == 1) version = 'n1';
else if (browser == "Microsoft Internet Explorer" && version >= 4) version = 'ie4';
else if (browser == "Microsoft Internet Explorer" && version == 3) version = 'ie3';
else if (browser == "Microsoft Internet Explorer" && version == 2) version = 'ie2';
else if (browser == "Microsoft Internet Explorer" && version == 1) version = 'ie1';
else version = "0";

// ************ microsoft explorer (4.x) **********************************************
if (document.all) {
			layerRef='document.all';
			styleRef='.style.';}
// ************* netscape (4.x) *******************************************************
else if (document.layers) {
			layerRef='document.layers';
			styleRef='.';}
// *** if current browser not (msie 4.x or netscape 4.x) ******************************
if (version != "n4" && version != "ie4") {
			location.href="browser.php";}

// *** choose browser stylesheet ******************************************************
if (version == "ie4" ) {
			if (agent == "MacPPC") {
				document.write('<LINK NAME="myStyle" REL="stylesheet" HREF="./mac.css" TYPE="text/css">');
			}	
			else  { 
				document.write('<LINK NAME="myStyle" REL="stylesheet" HREF="./ie4.css" TYPE="text/css">');
			
			}
}
else if (version == "n4") {
			if (agent == "MacPPC") {
				document.write('<LINK NAME="myStyle" REL="stylesheet" HREF="./mac.css" TYPE="text/css">');
			}	
			else  {
				document.write('<LINK NAME="myStyle" REL="stylesheet" HREF="./n4.css" TYPE="text/css">');
			}
			
}
// ************* dynamic HTML Show command ********************************************
function show(n)
{
	eval(layerRef+'["'+n+'"]'+styleRef+'visibility="visible"');
	eval(layerRef+'["'+n+'"]'+styleRef+'display=""');
}

// ************* dynamic HTML Hide command ********************************************
function hide(n)
{
	eval(layerRef+'["'+n+'"]'+styleRef+'visibility="hidden"');
	eval(layerRef+'["'+n+'"]'+styleRef+'display="none"');
}

// ************* open another window **************************************************
function windowOpen(httpLocation, x, y, w, h)
{
	eval('window.open("'+httpLocation+'", "Preview", "minimize=no, maximize=no, toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=1, resize=0, resizable=0, copyhistory=0, left='+x+', top='+y+', width='+w+', height='+h+'")');
}

// ************* zoom coverpage on another window *************************************
function showCoverPage(httpLocation)
{
	window.open(httpLocation , "Preview", "minimize=0, maximize=0, toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resize=0, resizable=0, copyhistory=0, left=100, top=80, width=270, height=380");
}

// ************************************************************************************
function jumpMag(list) 
{
	var object = "";
	var listValue = getListValue(list);
	
        if (listValue == 0) return;
        newWindow('home.asp?newMAGAZINE_ID=' + listValue);
}

// ************************************************************************************
function getListValue(list) 
{ 
	var listValue = "";
	if (list.selectedIndex != -1) 
	{ 
		listValue = list.options[list.selectedIndex].value; 
	} 
	return(listValue);
} 

// ************************************************************************************
function htmLink(linkPage)
{
	document.location.href=(linkPage);
}

// ************************************************************************************
function newWindow(linkPage)
{
	window.location.href=(linkPage);
}

// ************************************************************************************
function goHist(a)
{
	parent.history.go(a);
}
	
// ************************************************************************************
function checkText(n)
{
	var tmp = 0;
	var temp;	

	temp = 'if (document.' + n + '.value == "") { alert("Προσοχή!!! Δεν σημπληρώσατε την περιοχή κειμένου"); tmp = 1; }';
	eval(temp);
	return tmp ; 
}

// ************************************************************************************
function clock() 
{ 
	now= new Date();
	day= now.getDay(); 
	date= now.getDate(); 
	month= now.getMonth()+1; 
	year= now.getYear(); 

	dateStr = "";

	if (now.getDay() == 1) dateStr+= "Mon";
	else if (now.getDay() == 2) dateStr+= "Tue";
	else if (now.getDay() == 3) dateStr+= "Wen";
	else if (now.getDay() == 4) dateStr+= "Thu";
	else if (now.getDay() == 5) dateStr+= "Fri";
	else if (now.getDay() == 6) dateStr+= "Sat";
	else if (now.getDay() == 7) dateStr+= "Sun";

	dateStr+= ((date < 10) ? ", 0" : "") + date; 

	if (now.getMonth()+1 == 1) dateStr+= " Jan";
	else if (now.getMonth()+1 == 2) dateStr+= " Feb";
	else if (now.getMonth()+1 == 3) dateStr+= " Mar";
	else if (now.getMonth()+1 == 4) dateStr+= " Apr";
	else if (now.getMonth()+1 == 5) dateStr+= " May";
	else if (now.getMonth()+1 == 6) dateStr+= " Jun";
	else if (now.getMonth()+1 == 7) dateStr+= " Jul";
	else if (now.getMonth()+1 == 8) dateStr+= " Aug";
	else if (now.getMonth()+1 == 9) dateStr+= " Sep";
	else if (now.getMonth()+1 == 10) dateStr+= " Oct";
	else if (now.getMonth()+1 == 11) dateStr+= " Nov";
	else if (now.getMonth()+1 == 12) dateStr+= " Dec";

	dateStr+= ". "+ year; 
	hours= now.getHours(); 
	minutes= now.getMinutes(); 
	seconds= now.getSeconds(); 
	timeStr= "" + hours; 
	timeStr+= ((minutes < 10) ? ":0" : ":") + minutes;
	timeStr+= ((seconds < 10) ? ":0" : ":") + seconds;
	
//		document.clock.datetime.value = dateStr + " - " + timeStr; 
	
	Timer= setTimeout("clock()",1000);

}

// ************************************************************************************
function wait01(secs) 
{ 
 	var timeStr, newtimeStr;
	var now = new Date();
	
	if ((secs != 0 ) && (secs < 10))
	{
		hours= now.getHours(); 
		minutes= now.getMinutes(); 
		seconds= now.getSeconds(); 
		timeStr= "" + hours; 
		timeStr+= ((minutes < 10) ? ":0" : ":") + minutes;
		timeStr+= ((seconds < 10) ? ":0" : ":") + seconds;

		newseconds= now.getSeconds() + secs; 
		newtimeStr= "" + hours; 
		newtimeStr+= ((minutes < 10) ? ":0" : ":") + minutes;
		newtimeStr+= ((newseconds < 10) ? ":0" : ":") + newseconds;
			
		while (newtimeStr >  timeStr)
		{
			var now = new Date();	
			hours= now.getHours(); 
			minutes= now.getMinutes(); 
			seconds= now.getSeconds(); 
			timeStr= "" + hours; 
			timeStr+= ((minutes < 10) ? ":0" : ":") + minutes;
			timeStr+= ((seconds < 10) ? ":0" : ":") + seconds;
			document.waitFrm.waitCtl.value=timeStr;
		}
	}
	else return(secs);

}
