var uploadX = (screen.width/2)-200;
var uploadY = (screen.height/2)-100;
var pos = "left="+uploadX+",top="+uploadY;

function LoadSiteStatisticWindow(type,section,lang,pid,tid){
window.open("sitestatistic.asp?type="+type+"&section="+section+"&lang="+lang+"&pid="+pid+"&tid="+tid,"SiteStatistic","scrollbars=yes,width=540,height=350,"+pos);}

//Submit member form
function SubmitMembersForm(message){
if (window.document.frm_newsletter.title.value == "" || window.document.frm_newsletter.email.value == ""){;
alert(message);
if (window.document.frm_newsletter.title.value == ""){
window.document.frm_newsletter.title.focus ()}
else{
if (window.document.frm_newsletter.email.value == ""){
window.document.frm_newsletter.email.focus ()}}}
else{

var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i
var returnval=emailfilter.test(window.document.frm_newsletter.email.value)
if (returnval==false){
alert(message)
window.document.frm_newsletter.email.select ()}

else{
window.document.frm_newsletter.submit ()
window.document.frm_newsletter.title.value = ""
window.document.frm_newsletter.email.value = ""
window.document.frm_newsletter.realaction[0].checked = true}}}
//Submit member form


//Submit vote form
function GetValueFromVoteForm(VoteIndex){window.document.frm_vote.fp.value = VoteIndex}

function SubmitVoteForm(message){
if (window.document.frm_vote.fp.value == ""){
alert (message)}
else{
window.document.frm_vote.submit()}}
//Submit vote form


//Load vote result window
function LoadVoteResult(RecordID,CLang,NewHeight){
window.open("voteresult.asp?id="+RecordID+"&lang="+CLang,"voteresult","width=420,height="+NewHeight+","+pos);}
//Load vote result window


//Load comment window
function LoadCommentResult(RecordID,PageID,CLang){
window.open("comments.asp?commentid=0&id="+RecordID+"&pid="+PageID+"&lang="+CLang,"comments","scrollbars=1,width=430,height=500"+pos);}
//Load comment window


//set bookmark
var bookmarkurl= window.location.href 
var bookmarktitle= window.document.title 
function addbookmark(){
if (document.all){
window.external.AddFavorite(bookmarkurl,bookmarktitle)}}
//end set bookmark


//send mail to a friend
function sendmail(){
var initialsubj = window.document.title
var initialmsg = window.location
window.location = "mailto:?subject="+initialsubj+"&body="+initialmsg;}
//send mail to a friend


//prinable version
function pversionload(){
var pageurl= window.location.href + "?pt=5"
window.open (pageurl)}
//prinable version


//Blank Click
function BlankFunction(){var b}
//Blank Click


//SubmitFavoriesForm
function SubmitFavoriesForm(message){
if (window.document.frm_add_to_favorites.page_title.value == ""){
alert(message)
window.document.frm_add_to_favorites.page_title.focus ()}
else{
window.document.frm_add_to_favorites.submit ()}}
//SubmitFavoriesForm


//reloading images
var slidespeed=2000

//specify images
var slideimages=new Array("images/home/n_banner_04.gif","images/home/n_banner_05.gif","images/home/n_banner_06.gif")

//specify corresponding links
var slidelinks=new Array("dpage.asp?pid=43&lang=fa","dpage.asp?pid=7&lang=fa","linkestan.asp?lang=fa&pid=13&type=linkestan")

var newwindow=0 //open links in new window? 1=yes, 0=no

var imageholder=new Array()
var ee=document.all
for (i=0;i<slideimages.length;i++){
imageholder[i]=new Image()
imageholder[i].src=slideimages[i]
}

function gotoshow(){
if (newwindow)
window.open(slidelinks[whichlink])
else
window.location=slidelinks[whichlink]
}
//reloading images

//work with cookies
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

window.onload = createCookie('CorrectScreenWidth',screen.width,365);

//work with cookies



function newalert(message){alert(message)}
function loadclocation(location){window.location=location}