﻿//HttpAddress = 'http://localhost:2020/';
HttpAddress = "http://www.khanevade.net/";

function SetClass(ObjName,ClassName){
	if(!IsObj(ObjName)){alert(ObjName+" Is Not Valid");return false;}
	document.getElementById(ObjName).className = ClassName;
}

function IsObj(ObjName){
	if(document.getElementById(ObjName)==null){
		return false;
	}else{
		return true;
	}
}

function GetStFa(GetValue){
//    GetValue = GetValue.replace(/ه/g,'ە');
    GetValue = GetValue.replace(/ي/g,'ى');
    GetValue = GetValue.replace(/ي/g,'ى');
    GetValue = GetValue.replace(/ك/g,'ک');
    return  GetValue;    
}

function SetVal(ObjName,Text){
	if(!IsObj(ObjName)){alert(ObjName+" Is Not Valid");return false;}
	document.getElementById(ObjName).value = Text;
}

function GetVal(ObjName){
	if(!IsObj(ObjName)){alert(ObjName+" Is Not Valid");return false;}
	return document.getElementById(ObjName).value
}

function SetHtm(ObjName,Htm){
	if(!IsObj(ObjName)){alert(ObjName+" Is Not Valid");return false;}
	document.getElementById(ObjName).innerHTML = Htm;
}
function TestTextBox(EnName,FaName,Force,LenMin,LenMax,Format,Other){
//	alert("EnName = "+EnName+" FaName = "+FaName+" Force = "+Force+" LenMin = "+LenMin+" LenMax = "+LenMax+" Format = "+Format+" Other = "+Other)
	SetClass(EnName,"CSSTrueText");
	SetVal(EnName,GetStFa(GetVal(EnName)));
	var ItemValue = GetVal(EnName);
	SetHtm("Err"+EnName,"");
	var ErrMsg;
//--------------------------------------------------------------------- Force	
	if(Force){
		if(ItemValue.length == 0){
			SetClass(EnName,"CSSFalseText");
			ErrMsg = "فیلد " + FaName + " حتما باید تایین شود";
			SetHtm("Err"+EnName,ErrMsg);
			return 1;
		}
	}
	if(ItemValue.length >0){
//--------------------------------------------------------------------- Numeric	
		if(Format == "IsNumeric"){
			if(!IsNumeric(ItemValue)){
				SetClass(EnName,"CSSFalseText");
				ErrMsg = "فیلد " + FaName + " باید مقداری عددی باشد";
				SetHtm("Err"+EnName,ErrMsg);
				return 1;
			}
		}
//--------------------------------------------------------------------- NumericExcept	
		if(Format == "IsNumericExcept"){
			if(!IsNumericExcept(ItemValue,Other)){
				SetClass(EnName,"CSSFalseText");
				ErrMsg = "برای فیلد " + FaName + "اعداد بجز " + Other + " مجاز میباشد ";
				SetHtm("Err"+EnName,ErrMsg);
				return 1;
			}
		}
//--------------------------------------------------------------------- Mail	
		if(Format == "IsMail"){
			if(!IsMail(ItemValue)){
				SetClass(EnName,"CSSFalseText");
				ErrMsg = "فیلد " + FaName + " باید شامل یک پست الکترونیکی باشد";
				SetHtm("Err"+EnName,ErrMsg);
				return 1;
			}
		}
//--------------------------------------------------------------------- En
		if(Format == "IsEn"){
			if(!IsEn(ItemValue)){
				SetClass(EnName,"CSSFalseText");
				ErrMsg = "برای فیلد " + FaName + " فقط حروف انگلیسی مجاز میباشد ";
				SetHtm("Err"+EnName,ErrMsg);
				return 1;
			}
		}
//--------------------------------------------------------------------- CustomEn
		if(Format == "IsCustomEn"){
			if(!IsCustomEn(ItemValue,Other)){
				SetClass(EnName,"CSSFalseText");
				ErrMsg = "برای فیلد " + FaName + "کاراکترهای  فقط حروف انگلیسی بعلاوه " + Other + " مجاز میباشد ";
				SetHtm("Err"+EnName,ErrMsg);
				return 1;
			}
		}
//--------------------------------------------------------------------- EnExcept
		if(Format == "IsEnExcept"){
			if(!IsEnExcept(ItemValue,Other)){
				SetClass(EnName,"CSSFalseText");
				ErrMsg = "برای فیلد " + FaName + " حروف انگلیسی به جز " + Other + " مجاز میباشد ";
				SetHtm("Err"+EnName,ErrMsg);
				return 1;
			}
		}
//--------------------------------------------------------------------- Fa
		if(Format == "IsFa"){
			if(!IsFa(ItemValue)){
				SetClass(EnName,"CSSFalseText");
				ErrMsg = "برای فیلد " + FaName + " فقط حروف فارسی مجاز میباشد";
				SetHtm("Err"+EnName,ErrMsg);
				return 1;
			}
		}
//--------------------------------------------------------------------- CustomFa
		if(Format == "IsCustomFa"){
			if(!IsCustomFa(ItemValue,Other)){
				SetClass(EnName,"CSSFalseText");
				ErrMsg = "برای فیلد " + FaName + " فقط حروف فارسی بعلاوه کاراکترهای " + Other + " مجاز میباشد ";
				SetHtm("Err"+EnName,ErrMsg);
				return 1;
			}
		}
//--------------------------------------------------------------------- CheckBadString
		if(Format == "CheckBadString"){
			if(CheckBadString(ItemValue)){
				SetClass(EnName,"CSSFalseText");
				ErrMsg = 'برای فیلد ' + FaName + ' استفاده از کاراکترهای خاص مانند " < >  & % # \'  غیر مجاز میباشد ';
				SetHtm("Err"+EnName,ErrMsg);
				return 1;
			}
		}
//--------------------------------------------------------------------- EnDate
		if(Format == "IsEnDate"){
			if(IsEnDate(ItemValue)){
				SetClass(EnName,"CSSFalseText");
				ErrMsg = 'فیلد ' + FaName + 'باید شامل تاریخ میلادی باشد ';
				SetHtm("Err"+EnName,ErrMsg);
				return 1;
			}
		}
//--------------------------------------------------------------------- FaDate
		if(Format == "IsFaDate"){
			if(IsFaDate(ItemValue)){
				SetClass(EnName,"CSSFalseText");
				ErrMsg = 'فیلد ' + FaName + ' باید شامل تاریخ شمسی مثال ( 1389/11/15 ) باشد ';
				SetHtm("Err"+EnName,ErrMsg);
				return 1;
			}
		}
//--------------------------------------------------------------------- Time
		if(Format == "IsTime"){
			if(IsTime(ItemValue)){
				SetClass(EnName,"CSSFalseText");
				ErrMsg = 'فیلد ' + FaName + ' باید شامل تاریخ شمسی مثال ( 1389/11/15 ) باشد ';
				SetHtm("Err"+EnName,ErrMsg);
				return 1;
			}
		}
//--------------------------------------------------------------------- LenMin,LenMax
		if(!LenMin==0 && !LenMax==0){
			if(ItemValue.length < LenMin || ItemValue.length > LenMax){
				SetClass(EnName,"CSSFalseText");
				ErrMsg = "طول مجاز برای فیلد " + FaName + " حد اقل  " + LenMin + " کاراکتر و حد اکثر  " + LenMax + " کاراکتر میباشد.";
				SetHtm("Err"+EnName,ErrMsg);
				return 1;
			}
		}
//--------------------------------------------------------------------- LenMin
		if(!LenMin==0){
			if(ItemValue.length < LenMin){
				SetClass(EnName,"CSSFalseText");
				ErrMsg = "طول مجاز برای فیلد " + FaName + " حد اقل  " + LenMin + " کاراکتر می باشد ";
				SetHtm("Err"+EnName,ErrMsg);
				return 1;
			}
		}
//--------------------------------------------------------------------- LenMax
		if(!LenMax==0){
			if(ItemValue.length > LenMax){
				SetClass(EnName,"CSSFalseText");
				ErrMsg = "طول مجاز برای فیلد " + FaName + " حد اکثر  " + LenMax + " کاراکتر می باشد ";
				SetHtm("Err"+EnName,ErrMsg);
				return 1;
			}
		}
	}
	return 0;
}

function IsNumeric(GetValue){
	var StrExp = '^[0-9]+$';
	if(GetValue.match(StrExp)){
		return true;
	}else{
		return false;
	}
}

function IsNumericExcept(GetValue,No){
	var StrExp = '^[0-9][^'+No+']+$';
	if(GetValue.match(StrExp)){
		return true;
	}else{
		return false;
	}
}

function IsMail(GetValue){
	var EmailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-Z0-9]{2,4}$/;
	if(GetValue.match(EmailExp)){
		return true;
	}else{
		return false;
	}
}

function IsEn(GetValue){
	var AlphaExp = /^[a-z A-Z]+$/;
	if(GetValue.match(AlphaExp)){
		return true;
	}else{
		return false;
	}
}

function IsCustomEn(GetValue,OtherChar){              
	var AlphaExp = '^[a-z A-Z' + OtherChar + ']+$';
	if(GetValue.match(AlphaExp)){
		return true;
	}else{
		return false;
	}
}

function IsEnExcept(GetValue,OtherChar){
	var AlphaExp = /^[a-z A-Z][^n]+$/;
	if(GetValue.match(AlphaExp)){
		return true;
	}else{
		return false;
	}
}

function IsFa(GetValue){
	var StrExp = '^[هە ءآؤئابتثجحخدذرزسشصضطظعغفقكکلمنههويیپچژگ]+$';
	if(GetValue.match(StrExp))    {
		return true;
	}else{
		return false;
	}
}

function IsCustomFa(GetValue,OtherChar){ 
	GetValue = GetValue.replace(/-/g,'\-');          
	var AlphaExp = '^[هە ءآؤئابتثجحخدذرزسشصضطظعغفقكکلمنههويیپچژگ' + OtherChar + ']+$';
	if(GetValue.match(AlphaExp)){
		return true;
	}else{
		return false;
	}
}

function CheckBadString(GetValue){
	var StrExp = '[<>\'";&%#]+';
	if(GetValue.match(StrExp)){
		return true;
	}else{
		return false;
	}
}

function IsEnDate(GetValue){

	var StrExp = /^(0[1-9]|[12][0-9]|3[01])[ - /]?[0-1][1-9][ - / ]?(19|20|21)\\d{2,4}/;
	if(GetValue.match(StrExp)){
		return true;
	}else{
		return false;
	}
}

function IsFaDate(GetValue){
	var StrExp = /^(12|13|14)\d\d[ - / ]?[0-1][1-9][ - / ]?(0[1-9]|[12][0-9]|3[01])/;
	if(GetValue.match(StrExp)){
		return true;
	}else{
		return false;
	}
}

function IsTime(GetValue){
	var StrExp = /^([0-1][0-9]|[2][0-3]):([0-5][0-9])$/;
	if(GetValue.match(StrExp)){
		return true;
	}else{
		return false;
	}
}

//============================== set ajax
var xmlHttp = null;function CreateXmlHttpRequest(){if(window.ActiveXObject){xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');}else{xmlHttp = new XMLHttpRequest();}	return xmlHttp;}
CreateXmlHttpRequest();
//==============================
function checkPass(){
	UserName = GetVal('t1');
	PassWord = GetVal('t2');
	SetHtm('MyMsgPose',"<img border='0' src='"+HttpAddress+"mainpage/pic/AnimatedGif/loader1.gif'>");
	xmlHttp.open('post','CUserPass.asp',true);
	xmlHttp.onreadystatechange = updatePass;
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlHttp.send('UserName='+UserName+'&PassWord='+PassWord);
//alert("xmlHttp.send('UserName= '"+UserName+"' &PassWord= '"+PassWord);
}
function updatePass(){
//alert("xmlHttp.readyState " + xmlHttp.readyState + "xmlHttp.status " + xmlHttp.status);
//xmlHttp.status = 500 ==> dar File asp err asp vojood darad
	if(xmlHttp.readyState == 4){
		if(xmlHttp.status == 200){
			var message = xmlHttp.responseText;
//			alert("updatePass() message = " + message);
			if(message=="false"){
				SetHtm('MyMsgPose',"نام کاربری یا کلمه عبور صحیح نیست");
			}
			if(IsNumeric(message)){
				if(message=="0"){
					SetHtm('MyMsgPose',"مدیر گرامی دسترسی شما به پنل مسدود شده است");
				}else{
					setTimeout("window.location='"+HttpAddress+"module/administrator/admin.asp'",500);
					SetHtm('MyMsgPose',"به سیستم مدیریت سایت خوش آمدید");
				}
			}
		}else{
			var message = xmlHttp.responseText;
			SetHtm('MyMsgPose',"ارتباط با سرور برقرار نیست"+message);
		}
	}
}
//==-------------------------------

function SubmitForm(GetAction,Var1,Var2,Var3){
	if(GetAction=="GoToAddPage"){
		document.f1.action = "Additem.asp";
		document.f1.submit();
	}
	if(GetAction=="AddRecord"){
		if(TestForm()==0){
			document.f1.action = "Admin.asp";
			document.f1.FAction.value = GetAction;
			document.f1.submit();
		}
	}
	if(GetAction=="SetStatus"){
		//SubmitForm('SetStatus','20','Status')
		document.f1.action = "Admin.asp";
		document.f1.FID.value = Var1;
		document.f1.FFVar1.value = Var2;
		document.f1.FAction.value = GetAction;
		document.f1.submit();
	}
	if(GetAction=="SetOrder"){
		if(document.f1.FOrder1.value == Var1){
			if(document.f1.FOrder2.value == "desc"){
				document.f1.FOrder2.value = "asc";
			}else{
				document.f1.FOrder2.value = "desc";
			}
		}else{
			document.f1.FOrder1.value = Var1;
			document.f1.FOrder2.value = "asc";
		}
		document.f1.action = "Admin.asp";
		document.f1.FAction.value = GetAction;
		document.f1.submit();
	}
	if(GetAction=="EditItem"){
		document.f1.action = "Edititem.asp";
		document.f1.FID.value = Var1;
		document.f1.FAction.value = GetAction;
		document.f1.submit();
	}
	if(GetAction=="Update"){
		if(TestForm()==0){
			document.f1.action = "Admin.asp";
			document.f1.FAction.value = GetAction;
			document.f1.submit();
		}
	}
	if(GetAction=="delete"){
			var qu = window.confirm("Are you sure that content should be removed ?");
		if(qu){
			document.f1.action = "Admin.asp";
			document.f1.FID.value = Var1;
			document.f1.FAction.value = GetAction;
			document.f1.submit();
		}
	}
	if(GetAction=="SetPage"){
		document.f1.action = "Admin.asp";
		document.f1.FAction.value = GetAction;
		document.f1.FPage.value = Var1;
		document.f1.submit();
	}
	if(GetAction=="SetParentID"){
		document.f1.action = "Admin.asp";
		document.f1.FParent.value = Var1;
		document.f1.FAction.value = GetAction;
		document.f1.submit();
	}
	if(GetAction=="SetNewPath"){
		document.f1.action = "Admin.asp";
		document.f1.FAction.value = GetAction;
		document.f1.CurrentFolder.value = Var1;
		document.f1.submit();
	}
	if(GetAction=="SetUPPath"){
		document.f1.action = "Admin.asp";
		document.f1.FAction.value = GetAction;
		document.f1.submit();
	}
	if(GetAction=="Setpreview"){
	document.f1.action = "Admin.asp";
		document.f1.FAction.value = GetAction;
		document.getElementById(Var1).innerHTML = "<img border='0' src='"+Var2+"' width='40' height='45'>";
	}
	if(GetAction=="SetHome"){
		document.f1.action = "Admin.asp";
		document.f1.FAction.value = GetAction;
		document.f1.submit();
	}
	if(GetAction=="SetRefresh"){
		document.f1.action = "Admin.asp";
		document.f1.FAction.value = GetAction;
		document.f1.submit();
	}
	if(GetAction=="DeleteFile"){
		var qu = window.confirm("Are you sure you want to remove this file ?");
		if(qu){
			document.f1.action = "Admin.asp";
			document.f1.FAction.value = GetAction;
			document.f1.CurrentFile.value = Var1;
			document.f1.submit();
		}
	}
	if(GetAction=="rename"){
		document.f1.action = "Admin.asp";
		document.f1.FAction.value = GetAction;
		var theresponse = window.prompt("نام جدید را وارد کنید",Var1);
		if(theresponse){
			if(IsCustomEn(theresponse,"_.0123456789")){
				document.f1.CurrentFile.value = Var1+"."+Var2;
				document.f1.CurrentFile2.value = theresponse+"."+Var2;
				document.f1.submit();
			}else{
				alert("فقط حروف انگلیسی ، اعداد ، _ و .  مجاز می باشد");
			}
		}
	}
	if(GetAction=="NewFolder"){
		document.f1.action = "Admin.asp";
		document.f1.FAction.value = GetAction;
		var theresponse = window.prompt("نام پوشه را وارد کنید","NewFolder");
		if(theresponse){
			if(IsCustomEn(theresponse,"_.0123456789")){
				document.f1.CurrentFolder.value = theresponse;
				document.f1.submit();
			}else{
				alert("فقط حروف انگلیسی ، اعداد ، _ و .  مجاز می باشد");
			}
		}
	}
	if(GetAction=="DeleteFolder"){
		var qu = window.confirm("Are you sure you want to remove this Folder ?");
		if(qu){
			document.f1.action = "Admin.asp";
			document.f1.FAction.value = GetAction;
			document.f1.CurrentFolder.value = Var1;
			document.f1.submit();
		}
	}
	if(GetAction=="UnZip"){
		var qu = window.confirm("Are you sure you want to Extract this File ?");
		if(qu){
			var theresponse = window.prompt("اگر فایل دارای پسورد است، لطفا پسورد را وارد کنید","");
			if(theresponse){
				document.f1.CurrentFile2.value = theresponse;	
			}else{
				document.f1.CurrentFile2.value = '';	
			}
			document.f1.action = "Admin.asp";
			document.f1.FAction.value = GetAction;
			document.f1.CurrentFile.value = Var1;
			document.f1.submit();
		}
	}
	if(GetAction=="SetPermission"){
		document.f1.action = HttpAddress+'module/Permission/Edititem.asp';
		document.f1.FID.value = Var1;
		document.f1.FAction.value = 'EditItem';
		document.f1.submit();
	}
	if(GetAction=="SetSearch"){
		document.f1.action = "Search.asp";
		document.f1.FAction.value = GetAction;
		document.f1.FPage.value = 1;
		document.f1.IsSearch.value = 1;
		document.f1.submit();
	}
	if(GetAction=="SetExport"){
		document.f1.action = "Export.asp";
		document.f1.FAction.value = GetAction;
		document.f1.FPage.value = 1;
		document.f1.IsSearch.value = 1;
		document.f1.submit();
	}
	if(GetAction=="SetModuleID"){
		document.f1.action = HttpAddress+'module/'+Var2+'/admin.asp';
		document.f1.FParent.value = Var1;
		document.f1.FAction.value = 'SetModuleID';
		document.f1.submit();
	}

}
//-----------------------------------------------------------------------------   (show and hidden ShowColorPicker)
	var CColorPicker = "";
	function ExitColorPicker(){
		document.getElementById("ColorPicker").style.visibility = "hidden";
	}

	function ShowColorPicker(num){
		HiddenAllIframe();
		CColorPicker = num
		document.getElementById('ColorPicker').src = HttpAddress+"Plugin/ColorPicker/ColorPicker.asp";
		ColorPickerTableHeight = 230;
		ColorPickerTableWidth = 200;

		MyLeft = findPosX(document.getElementById(CColorPicker))+parseInt(document.getElementById(CColorPicker).style.width) - ColorPickerTableWidth;
		MyTop = findPosY(document.getElementById(CColorPicker))
		if(screen.height<MyTop+ColorPickerTableHeight+200){
			MyTop = MyTop - ColorPickerTableHeight + 25;
		}
		document.getElementById("ColorPicker").style.position = "absolute";
		document.getElementById("ColorPicker").style.left = MyLeft;
		document.getElementById("ColorPicker").style.top = MyTop;
		document.getElementById("ColorPicker").style.visibility = "visible";
	}

//-----------------------------------------------------------------------------   (show and hidden calender page)
	var CDateitem = 0;
	function SetDateValue(num){
		if(num!=0){
			document.getElementById(CDateitem).value = num;
		}
		document.getElementById("CalendarView").style.visibility = "hidden";
	}

	function ShowCalendar(num){
		HiddenAllIframe();
		CDateitem = num
		document.getElementById('CalendarView').src = HttpAddress+"mainpage/asp/CP/Calendar.asp";
		CalendarTableHeight = 230;
		CalendarTableWidth = 200;

		MyLeft = findPosX(document.getElementById(CDateitem)) + +parseInt(document.getElementById(CDateitem).style.width) - CalendarTableWidth;
		MyTop = findPosY(document.getElementById(CDateitem))
		if(screen.height<MyTop+CalendarTableHeight+200){
			MyTop = MyTop - CalendarTableHeight + 25;
		}
		document.getElementById("CalendarView").style.position = "absolute";
		document.getElementById("CalendarView").style.left = MyLeft;
		document.getElementById("CalendarView").style.top = MyTop;
		document.getElementById("CalendarView").style.visibility = "visible";
	}


//-----------------------------------------------------------------------------/////(hidden All Frame)

	function HiddenAllIframe(){
		document.getElementById("ColorPicker").style.visibility = "hidden";
		document.getElementById("CalendarView").style.visibility = "hidden";
	}
	
//-----------------------------------------------------------------------------   
function findPosX(obj){
	var curleft = 0;
	if(obj.offsetParent)
		while(1){
			curleft += obj.offsetLeft;
			if(!obj.offsetParent)break;
			obj = obj.offsetParent;
		}
		else if(obj.x) curleft += obj.x;
	return curleft;
}
//-----------------------------------------------------------------------------   
function findPosY(obj){
	var curtop = 0;
	if(obj.offsetParent)
		while(1){
			curtop += obj.offsetTop;
			if(!obj.offsetParent)break;
			obj = obj.offsetParent;
		}
	else if(obj.y)curtop += obj.y;
	return curtop;
}
//-----------------------------------------------------------------------------   (show and hidden RichText page)
function ShowTextEditor(FieldName){
	CRichText = FieldName;
	if(GetVal(CRichText)!=''){
		TRichText = GetVal(CRichText);
	}
	CalendarTableHeight = 650
	CalendarTableWidth = 850
	MyTop = (window.screen.height - CalendarTableHeight) / 2;
	MyLeft = (window.screen.width - CalendarTableWidth) / 2;
	OpenUrl(HttpAddress+"Plugin/TextEditorPro/TextEditor.html","",CalendarTableHeight,CalendarTableWidth,MyLeft,MyTop)
}

function SetRichText(text){
	if(text!=0){
		SetVal(CRichText,text);
	}
}

function OpenUrl(url_,Name_,height_,width_,left_,top_){
	MyWin = window.open(url_,Name_,'height=' + height_ + ',width=' + width_ + ',left=' + left_ +',top=' + top_ + ',resizable=no,scrollbars=no,toolbar=no,status=no');
}

function TestDropDownSelect(EnName,FaName){
	ErrMsg = "";
	if(GetVal(EnName)=='---'){
		SetHtm("Err"+EnName,FaName + " باید انتخاب شود");
		return 1;
	}
	SetHtm("Err"+EnName,"");
	return 0;
}

function TestCheckbox(EnName,FaName){
	var ItemValue = document.getElementById(EnName).checked;
	if(ItemValue == false){
		SetHtm("Err"+EnName,FaName + " باید انتخاب شود");
		return 1;
	}
	return 0;
}

function ShowImageViewer(num){
	Cpicaddress = num;
	CalendarTableHeight = 500
	CalendarTableWidth = 600
	MyTop = (window.screen.height - CalendarTableHeight) / 2;
	MyLeft = (window.screen.width - CalendarTableWidth) / 2;
	OpenUrl(HttpAddress+"Plugin/PictureViewer/viewer.asp","",CalendarTableHeight,CalendarTableWidth,MyLeft,MyTop)
	//			MyWin1 = window.open(HttpAddress+"module/picture_viewer/viewer.asp","viewer",'height=' + CalendarTableHeight + ',width=' + CalendarTableWidth + ',left=' + MyLeft +',top=' + MyTop + ',resizable=no,scrollbars=no,toolbar=no,status=no');
}

var CFieldName = "";
function UserAttachFile(Fname){
	CFieldName = Fname;
	mypageadmin = OpenUrl(HttpAddress+"mainpage/asp/CP/userattach.asp","UserAtachFile",250,500,40,20);
}

function SetFileAddress(FileName){
	document.getElementById(CFieldName).value = FileName;
}
