function winClose()
{
}

function chapa()
{//alert("ok");
	var elt = document.getElementById("storyText");
if (elt)
	{
		
		var storyText = elt.innerHTML;
		var UA =  document.all("copyrightdiv").innerHTML;
		//alert( UA);
		var win = window.open("chapa.htm","chapa", "status=0,location=0,resizable=1,toolbar=1,scrollbars=1")
		if (win)
		{
			/*prn="<div align=right width=100%><a href='javascript:chapa()'><IMG src='picha/print.gif' border=0>&nbsp;&nbsp;PRINT</a></div><br>";*/
            //self.setTimeout('winClose()	;', 500)
            if (win.document)
            {
                storyText = "<html><body><table ><tr><td>" + storyText + "</td></tr><tr height=25px valign=bottom><td style='FONT-SIZE: 9px; FONT-FAMILY: verdana;'>" + UA + "</td></tr></table></body></html>"
                win.document.open("text/html", "replace");
                win.document.write(storyText);
                win.focus()	;
                //win.close();	
                //win.print();
            }
		}
	}
}

// Email Validation. Written by PerlScriptsJavaScripts.com

function check_email(e) 
{
	var ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";

	for(i=0; i < e.length ;i++)
	{
		if(ok.indexOf(e.charAt(i))<0)
		{ 
			return (false);
		}	
	} 

	if (document.images) 
	{
		re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
		re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
		if (!e.match(re) && e.match(re_two)) 
		{
			return (-1);		
		} 

	}
}

function check_form(f) 
{	// f is the form (passed using the this keyword)

	// check the first email address ( comma delimted values possible )
	var emails = new String(f.email.value);
	
	if (emails.indexOf(",") != -1)
	{
		var splitArg = emails.split(",");
		//alert(splitArg.length)
		var i=0;
		for (i=0; i<=splitArg.length; i++) //max five emails validated
		{
			var tmp = new String(splitArg[i]);
			
			if (tmp.length > 0 && tmp != "undefined")
			{
				if(!check_email(tmp))
				{
					alert("Invalid email detected.");
					f.email.focus(); 
					// if the browser is Netscape 6 or IE
					if(document.all || document.getElementByID)
					{
						// change the color of text field
						f.email.style.background = "yellow";
					}
					// make sure the form is not submitted
					return false;
				}			
			}
		}
	}
	else
	{
		if(!check_email(f.email.value))
		{
			alert("Invalid email detected.");
			f.email.focus(); 
			// if the browser is Netscape 6 or IE
			if(document.all || document.getElementByID)
			{
				// change the color of text field
				f.email.style.background = "yellow";
			}
			// make sure the form is not submitted
			return false;
		}			
	
	}
	
	//FROM is required
	if(f.from.value.length < 1)
	{
		alert("Enter the name or email of the sender.");
		f.from.focus(); // put the prompt in the name field 
		// if the browser is Netscape 6 or IE
		if(document.all || document.getElementByID)
		{
			// change the color of text field
			f.from.style.background = "yellow";
		}
		// make sure the form is not submitted
		return false;
	}
	
	var htm ="";
	var txt = "";
	
	/*
	if	(document.layers) 
	{
		htm = document.layers["storyText"].innerTEXT; 
		txt = document.layers["storyText"].innerHTML; 
	} 
	else if (document.getElementById) 
	{
		var elt = document.getElementById("storyText");
		if (elt)
		htm = elt.innerHTML;
		//txt = document.getElementById("storyText").innerTEXT;
	} 
	else if (document.all) 
	{
		htm =document.all("storyText").innerHTML;
		txt=document.all("storyText").innerTEXT;	
	}
	*/
	
	var elt = document.getElementById("storyText");
	if (elt)
	{
	    f.payload.value=elt.innerHTML
	    //alert(elt.innerHTML );
	    //alert(f.payload.value );
	    //return false;
		    // submit the form
	    f.action	= "1_sendmail.asp"			//here the page
	    f.submit();
	}
	
	//alert(htm)
	//alert(txt)
}

function checkdiv(f)
{
	//document.frames("frame2").document.all.accountsTableDIV.innerHTML = "";
		var elt = document.getElementById("storyText");
		if (elt)
	alert(document.all("storyText").innerHTML );
	return false;
}

	function ShowDiv(DivName)
	{
		if	(document.layers) {
			document.layers[DivName].visibility="visible"; 
		} else if (document.getElementById) {
			document.getElementById(DivName).style.display="";
			document.getElementById(DivName).style.visibility="visible";
		} else if (document.all) {
			document.all(DivName).style.display="";
			document.all(DivName).style.visibility="visible";	
		}
	}
	
	function HideDiv(DivName) 
	{
		if	(document.layers) {
			document.layers[DivName].visibility="hidden"; 
		} else if (document.getElementById) {
			document.getElementById(DivName).style.display="none";
			document.getElementById(DivName).style.visibility="hidden";
		} else if (document.all) {
			document.all(DivName).style.display="none";
			document.all(DivName).style.visibility="hidden";	
		}
	}
	

    
/*
Use regular expressions to remove the white space 
*/

function trimString (str) 
{
	if (window.RegExp) 
	{
		str = /*this != window? this :*/ new String(str);
		if(str.length>0)
		{
			return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
		}
		else
		{
			return "";
		}
	}
}

function launchCenterNoLocation(url, name, height, width) 
{
  var str = "height=" + height + ",innerHeight=" + height;
  str += ",width=" + width + ",innerWidth=" + width;
  str += ",status=0,location=0,resizable=1,toolbar=1,scrollbars=1";
  if (window.screen) 
  {
    var ah = screen.availHeight - 30; //for taskbar?
    var aw = screen.availWidth - 10;
		
    var xc = (aw - width) / 2;
    var yc = (ah - height) / 2;

    str += ",left=" + xc + ",screenX=" + xc;
    str += ",top=" + yc + ",screenY=" + yc;
  }
  return window.open(url, name, str);
}

/*
	launch a centered window
*/
function launchCenter(url, name, height, width) 
{
  var str = "height=" + height + ",innerHeight=" + height;
  str += ",width=" + width + ",innerWidth=" + width;
  str += ",status=0,location=0,resizable=0,toolbar=0";
  if (window.screen) 
  {
    var ah = screen.availHeight - 30; //for taskbar?
    var aw = screen.availWidth - 10;
		
    var xc = (aw - width) / 2;
    var yc = (ah - height) / 2;

    str += ",left=" + xc + ",screenX=" + xc;
    str += ",top=" + yc + ",screenY=" + yc;
  }
  return window.open(url, name, str);
}

function  launchCenterDlg(url, name, height, width)
{	
	if (window.showModalDialog)
	{
		var vArguments = "";
		var sFeatures = "help:no;dialogHeight:" + height + "px;dialogWidth:" + width + "px;center: yes"
		var win = window.showModalDialog(url , vArguments, sFeatures);//break here until moday is closed
	}
	else
	{
		launchCenter(url, name, height, width) ;
	}
} 

function onyeshaupload()
{//alert("chk");
	//launchCenter('UploadASP/PostFile.asp', 'PostFile', 200, 450);
	launchCenter('UploadASP/PostFile.htm', 'PostFile', 200, 450);
}

function onyeshaandiko()
{
	launchCenter('UploadASP/SaveFile.asp', 'PostFile', 450, 600);
}


function wasilishakwaemeli(id)
{
	launchCenter('sendmail.asp?storyid=' + id, 'sendemail', 270, 375);
}

/*
*/
var today	= new Date();
var date	= today.getDate();
//var year	= today.getYear();
var month	= today.getMonth()+1;
var day		= today.getDay();
var hr		= today.getHours();
var min		= today.getMinutes();
//var secs	= today.getSeconds();
var yyyy	= today.getFullYear();	

function dateyyymmmddd()
{
	return yyyy + "/" + month + "/" + date + "  " + hr + ":" + min
}

/**/
function yesterdayDate()
{
	return yyyy + "/" + month + "/" + parseInt(date-1) + "  " + hr + ":" + min
}

var today=new Date();
var day = today.getDay();
var month= today.getMonth();
var date= today.getDate();
var year = today.getFullYear();
months = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
monthsj = new Array("1","2","3","4","5","6","7","8","9","10","11","12");
days = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
//daysj = new Array("j","j","Ηj","j","ؗj","j","yj");

function todaysDate()
{
	for(i=0;i<12;i++)
	{
		if(i==month)
		{
			var m=months[i];
		}
	}
	
	for(j=0; j<7; j++)
	{
		if(j==day)
		{
			var d=days[j];
		}
	} 
	document.write("" + d + "," + "&nbsp;" + m + "&nbsp;" + date + "," + "&nbsp;" + year + "&nbsp;");
}

function IsNull(arg)
{
	var result = false;
	var temp = new String(arg);
	//(temp.length == 4 && temp.substr(0,4) == "NULL"))
	if ( (temp.length == 4) && (temp=="null" || temp== "NULL") ) result = true;
	return result;
}

function BackToTop()
{
    //document.window.href="news-new.htm";
    //alert(window.location.href);
    window.location.href="news.htm";
}

function raiseEditor()
{
    
}