function PhotoWin(photoURL,photoTitle,Ws,Hs)
{
	wnd_x=(screen.availWidth/2)-(Ws/2);
	wnd_y=(screen.availHeight/2)-(Hs/2);

	conf =  'width='+Ws+',height='+Hs
	conf += ',left='+wnd_x+',top='+wnd_y
	conf += ',location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no'
	poop =  window.open ('','PhotoGallery',conf)	

	with (poop)
	{
		document.open();
		document.write('<meta http-equiv=\"imagetoolbar\" content=\"no\">');
		document.write('<head>');
		document.write('<meta http-equiv="Content-Type" content="text/html; charset=utf-8">');
		document.write('<title>' + photoTitle + '</title>');
		document.write('</head>');
			document.write('<body oncontextmenu=\"return false\" onselectstart=\"return false\" ondragstart=\"return false\" leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" scroll=\"no\" bgcolor=\"#FFFFFF\">');
			document.write('<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0" name="tbl_loading" id="tbl_loading"><tr align="center" valign="middle">');
		document.write('	<td align="center" valign="middle" style="background-image: url(\'../images/progress.gif\'); background-repeat: no-repeat; background-position: center">');
	
        document.write('<div style="position: absolute; left: 2px; bottom: 2px; z-index:3; visibility:visible" id="btnPrint">');
		document.write('<button onclick="window.print()" name="btnPrint" id=oBtnPrint style="width: 70px; height: 28px">');
		document.write('<font style="font-size: 8pt" face="Tahoma">چاپ</font>');
		document.write('</button></div>');

			document.write('<img width=' + Ws + ' height=' + Hs + ' id="img_big" align="center" valign="middle" src="' + photoURL + '" border="0">');
		document.write('</td></tr></table>')
		document.close();
	}

	poop.focus();
}


// ****************************
// ****************************
/*
//change 1 to another integer to alter the scroll speed. Greater is faster
var speed=1
var currentpos=0, alt=1, curpos1=0, curpos2=-1

function initialize(){
	startit()
}

function scrollwindow(){
	if (document.all && !document.getElementById)
		temp=document.body.scrollTop
	else
		temp=window.pageYOffset
	if (alt==0)
		alt=2
	else
		alt=1
	if (alt==0)
		curpos1=temp
	else
		curpos2=temp
	if (curpos1!=curpos2){
		if (document.all)
			currentpos=document.body.scrollTop+speed
		else
			currentpos=window.pageYOffset+speed
		window.scroll(0,currentpos)
	}
	else{
		currentpos=0
		window.scroll(0,currentpos)
	}

}

function startit(){
	setInterval("scrollwindow()",50)
}

window.onload=initialize
//var runscript = "window.setTimeout(initialize,15000)"
//eval(runscript)


// ****************************
*/


//  ********************************************************************
//  ********************************************************************
//  Email Validation
RE=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/   // Email Validate


//  ********************************************************************
//  ********************************************************************
function Trim(STRING){
	STRING = LTrim(STRING);
	return RTrim(STRING);
}
/* *********************** */
function RTrim(STRING){
	while(STRING.charAt((STRING.length -1))==" "){
	STRING = STRING.substring(0,STRING.length-1);
	}
	return STRING;
}
/* *********************** */
function LTrim(STRING){
	while(STRING.charAt(0)==" "){
	STRING = STRING.replace(STRING.charAt(0),"");
	}
	return STRING;
}
/* *********************** */
function Left(STRING,CHARACTER_COUNT){
	return STRING.substring(0,CHARACTER_COUNT);
}
/* *********************** */
function Right(STRING,CHARACTER_COUNT){
	return STRING.substring((STRING.length - CHARACTER_COUNT),STRING.length);
}
/* *********************** */
function IsNumeric(VALUE){
	Noghte = 0
	if (VALUE.charCodeAt(0) == 46 || VALUE.charCodeAt(VALUE.length-1) == 46)
		return false;

	for(var b = 0; b < VALUE.length;b ++){
		if(VALUE.charCodeAt(b) == 46)
			Noghte = Noghte + 1
		if(VALUE.charCodeAt(b) < 48 || VALUE.charCodeAt(b) > 57)
			if(VALUE.charCodeAt(b) != 46)
				return false;
	}

	if (Noghte > 1)
		return false;

	return true;
}


//  ********************************************************************
//  ********************************************************************
//  Block key: 1 2 3 4 5 6 7 8 9 0 and enter
function BlockKeyNum3()
{
	// Numeric Code
	if (event.keyCode < 45 || event.keyCode > 57) 
		event.returnValue = false

	// Enter Code
	if (event.keyCode == 13 )
		event.returnValue = true		
}

//  ********************************************************************
//  ********************************************************************
function ContactValidation(frm){
	Fail = true
	
	for (i=1; i<=5; i++)
		document.getElementById("er"+i).className = "FormError2"

	if (Trim(frm.fullname.value).length < 4){
		document.getElementById("er1").className = "FormError1"
		Fail = false
	}

	if (Trim(frm.mobile.value).length != 0)
		if (Trim(frm.mobile.value).length < 11){
			document.getElementById("er2").className = "FormError1"
			Fail = false
		}

	if (Trim(frm.phone.value).length != 0)
		if (Trim(frm.phone.value).length < 6){
			document.getElementById("er3").className = "FormError1"
			Fail = false
		}

	if (Trim(frm.email.value).length != 0)
		if (!RE.test(Trim(frm.email.value))){
			document.getElementById("er4").className = "FormError1"
			Fail = false
		}

	if (Trim(frm.mobile.value).length == 0 && Trim(frm.phone.value).length == 0 && Trim(frm.email.value).length == 0){
		document.getElementById("er5").className = "FormError1"
		Fail = false
	}

	if (!Fail)
		return false
	else 
		return true
}





