// JavaScript Document
var selected_teaser =1;
var teaserTimeout;

var mmTimeout;
function Set_Cookie( name, value, expires, path, domain, secure ) 
{
// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );

/*
if the expires variable is set, make the correct 
expires time, the current script below will set 
it for x number of days, to make it for hours, 
delete * 24, for minutes, delete * 60 * 24
*/
if ( expires==1 ) 
	expires = 30 * 1000 * 60  ;  
else 
	expires = 10 * 1000 * 60 ;
var expires_date = new Date( today.getTime() + (expires) );

document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
( ( path ) ? ";path=" + path : "" ) + 
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}


// this function gets the cookie, if it exists
function Get_Cookie( name ) {
	
var start = document.cookie.indexOf( name + "=" );
var len = start + name.length + 1;
if ( ( !start ) &&
( name != document.cookie.substring( 0, name.length ) ) )
{
return null;
}
if ( start == -1 ) return null;
var end = document.cookie.indexOf( ";", len );
if ( end == -1 ) end = document.cookie.length;
return unescape( document.cookie.substring( len, end ) );
}


// this deletes the cookie when called
function Delete_Cookie( name, path, domain ) {
if ( Get_Cookie( name ) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

var message="Your right mouse button works fine!";

function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")

document.execCommand("BackgroundImageCache", false, true);

function print_content(source_div) {
  var p_l_pos = (screen.width-760) / 2;
 var p_t_pos = (screen.height-1024) / 2;
 var print_window  = window.open('print.php?c=' + source_div +'','print_popup','left=' + p_l_pos + ',top=' + p_t_pos + ',width=860,height=560,resizable=0,location=0,menubar=0,scrollbars=yes,status=0,toolbar=0');
 if (!print_window) {
 	alert('Grrrrr!\n A pop-up blocker has blocked the print window\n Please fix this and retry...!');
 }
 else {
	print_window.focus(); 
//	var p_div  = print_window.document.getElementById('print_contents_div');
//	if (p_div!=null) {
//		p_div.innerHTML = document.getElementById(source_div).innerHTML;
//	} 
 }

} 
function wait_screen(div_name) {
	if (div_name!='') {
		document.getElementById('' + div_name + '').innerHTML='<center><img src="../gui/images/loading.gif" width="20" height="20"></center>'; //<br>Μεταφορά δεδομένων. Παρακαλώ περιμένετε <br>
	} return false;
}
var c1;
var c2;

function show_comment(content) {
	if (content!='') document.getElementById('comment_content_div').innerHTML = '' + content;
	var c1 = setTimeout("Effect.toggle('master_comments_div','appear'); ",2000); 
	var c2 = setTimeout("Effect.toggle('master_comments_div','slide'); ",7000); 
}

function modify_dates (start_date, end_date) {
	document.getElementById('date_from_value_div').innerHTML='<input type=hidden name="sdate" value="' + start_date + '">' + start_date + ''; 
	document.getElementById('date_to_value_div').innerHTML='<input type=hidden name="edate" value="' + end_date + '">' + end_date + ''; 
	return false;
}

function nada_void() {
	start_loader();
}
function show_div(div_name) {
	if (div_name!='') {
		var t = document.getElementById('' + div_name + '').style.display;
		if (t!='block')
		document.getElementById('' + div_name + '').style.display='block';
	} return false;
	
}
function hide_div(div_name) {
	if (div_name!='') {
		var t = document.getElementById('' + div_name + '').display;
		if (t!='none')
		document.getElementById('' + div_name + '').style.display='none';
	} return false;
	
}
function toggle_div(div_name) {
	if (div_name!='') {
		var t = document.getElementById('' + div_name + '').style.display;
		if (t!='block')
			document.getElementById('' + div_name + '').style.display='block';
		else
			document.getElementById('' + div_name + '').style.display='none';
	} return false;
	
}

function hide_main_menu() {
	window.clearTimeout(mmTimeout);
	mmTimeout = window.setTimeout("hide_div('main_menu_div');",1000);
	return false;
}

