﻿//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//  Farsi User Validating Function
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	
function Contact_Us_Validating(base_path)
{

	var check=true;
	var css='input_txt';
	var css_error='input_txt_error';	
	var css_error_box='Contact_TD_Error';		
	
	document.getElementById('Contact_Name').className=css;
	document.getElementById('Contact_Email').className=css;
	document.getElementById('Contact_Body').className=css;
	document.getElementById('Contact_Security_Code').className=css;	
	
	if (trim(document.getElementById('Contact_Name').value)=="") 
	{
		document.getElementById('Contact_Name').className=css_error;
		check=false;
	}
	
	var check_email=email_validate(document.getElementById('Contact_Email').value);
	if ((trim(document.getElementById('Contact_Email').value)!="") && check_email==false) 
	{
		document.getElementById('Contact_Email').className=css_error;
		check=false;
	}
	
	
	if (trim(document.getElementById('Contact_Body').value)=="") 
	{
		document.getElementById('Contact_Body').className=css_error;
		check=false;
	}	
	
	if (trim(document.getElementById('Contact_Security_Code').value)=="") 
	{
		document.getElementById('Contact_Security_Code').className=css_error;
		check=false;
	}
	else
	{
		if (document.getElementById('Contact_Security_Code').value.length<5)
		{
			document.getElementById('Contact_Security_Code').className=css_error;
			check=false;
		}
	}


if (check===false)
{
  alert("Error! Please check the highlighted fields. ");
}
else
{

 	var oForm = document.forms.Contact_Box_Form;
	var Request_Query_String=getRequestBody(oForm);
	Process_Loader("Contact_Box_Body_TD","Please wait. Sending ...",base_path);
    Set_Content('post','process.php',Request_Query_String,true,'Contact_Box_Body_TD');
    return true;

}

}

//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------

function NewsLetter_Validating(base_path)
{

	var check=true;
	var css='input_txt';
	var css_error='input_txt_error';	
	var css_error_box='Contact_TD_Error';		
	
	document.getElementById('NLR_Name').className=css;
	document.getElementById('NLR_Email').className=css;
	document.getElementById('NLR_Security_Code').className=css;	
	
	if (trim(document.getElementById('NLR_Name').value)=="") 
	{
		document.getElementById('NLR_Name').className=css_error;
		check=false;
	}
	
	var check_email=email_validate(document.getElementById('NLR_Email').value);
	if ((trim(document.getElementById('NLR_Email').value)=="") || check_email==false) 
	{
		document.getElementById('NLR_Email').className=css_error;
		check=false;
	}
	

	if (trim(document.getElementById('NLR_Security_Code').value)=="") 
	{
		document.getElementById('NLR_Security_Code').className=css_error;
		check=false;
	}
	else
	{
		if (document.getElementById('NLR_Security_Code').value.length<5)
		{
			document.getElementById('NLR_Security_Code').className=css_error;
			check=false;
		}
	}


if (check===false)
{

  alert("Error! Please check the highlighted fields. ");
}
else
{

 	var oForm = document.forms.NLRegister_Box_Form;
	var Request_Query_String=getRequestBody(oForm);
	
	Process_Loader("NLRegister_Box_Body_TD","Please wait. Sending ...",base_path);
    Set_Content('post',base_path+'process.php',Request_Query_String,true,'NLRegister_Box_Body_TD');
	return true;


}

}



//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------


function Message_Validating(base_path)
{

	var check=true;
	var css='input_txt';
	var css_error='input_txt_error';	
	var css_error_box='Contact_TD_Error';		
	
	document.getElementById('Msg_Name').className=css;
	document.getElementById('Msg_Email').className=css;
	document.getElementById('Msg_Web').className=css;
	document.getElementById('Msg_Body').className=css;	
	document.getElementById('Msg_Security_Code').className=css;	
	
	if (trim(document.getElementById('Msg_Name').value)=="") 
	{
		document.getElementById('Msg_Name').className=css_error;
		check=false;
	}
	
	var check_email=email_validate(document.getElementById('Msg_Email').value);
	if ((trim(document.getElementById('Msg_Email').value)!="") && check_email==false) 
	{
		document.getElementById('Msg_Email').className=css_error;
		check=false;
	}
	
	
	if (trim(document.getElementById('Msg_Body').value)=="") 
	{
		document.getElementById('Msg_Body').className=css_error;
		check=false;
	}	
	
	if (trim(document.getElementById('Msg_Security_Code').value)=="") 
	{
		document.getElementById('Msg_Security_Code').className=css_error;
		check=false;
	}
	else
	{
		if (document.getElementById('Msg_Security_Code').value.length<5)
		{
			document.getElementById('Msg_Security_Code').className=css_error;
			check=false;
		}
	}


if (check===false)
{
  alert("Error! Please check the highlighted fields. ");
}
else
{

 	var oForm = document.forms.Message_Box_Form;
	var Request_Query_String=getRequestBody(oForm);
	Process_Loader("Message_Box_Body_TD","Please wait. Sending ...",base_path);
    Set_Content('post','process.php',Request_Query_String,true,'Message_Box_Body_TD');
    return true;

}

}

//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------

function Load_Message(message_id,message_name,message_date,message_txt,message_url,style)
{ 
		var mbody='';
			mbody+='<table width="90%" align=center border="0" cellspacing="0" cellpadding="0" style="margin-top:10px; margin-bottom:10px">';
			mbody+="<tr><td align=right>";
			mbody+='<A href="javascript:Close_Message();"><img src="theme/english/img/close.png" vspace="2" hspace="2" width="12" height="12" border="0" /></A>'
			mbody+="</td><tr>";
			mbody+="<tr><td>";
					mbody+="<table style=\"margin-top:5px;\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
					mbody+="<tr>";
					mbody+="<td class=\"name\" style=\"padding-left:5px;\">"+message_name+"</td>";
					if (trim(message_url)!='')
					{
					mbody+="<td class=\"web\"   width=\"10\"><a target=_blank class=\"message_url\" href=\""+message_url+"\">W</a></td>";
					}
					else
					{
					mbody+="<td  width=\"10\"></td>";
					}
					mbody+="<td class=\"date1\" width=\"90\" style=\"padding-left:5px;\">"+message_date+"</td>";
					mbody+="</tr>";					
					mbody+="</table>";										
			mbody+="</td></tr>";
			//mbody+="<tr><td class=\"comment\" style=\"padding-top:5px\" >"+message_txt+"</td></tr>";	
			//alert('dd==>'+document.getElementById('MSGB_TXT'+message_id).value)
			var msg = document.getElementById('MSGB_TXT'+message_id).value;
			var msg = msg.replace(/%%%#%%%/g,'"');
			mbody+="<tr><td style=\"padding-top:5px\" "+style+" >"+msg+"</td></tr>";						
			mbody+="</table>";		
		
		document.getElementById('MSGB_Show').innerHTML=mbody;
		//--------------------------
		//document.getElementById('MSGB_Show').style.visibility='visible';
		//document.getElementById('MSGB_Show').style.display='block';
		  //------------------
		  var arrPageSizes = __getPageSize();
		 // document.getElementById('MSGB_Show').style.top=arrPageSizes[1]/2- (document.getElementById('MSGB_Show').clientHeight)/2-100;
		 // document.getElementById('MSGB_Show').style.left=arrPageSizes[0]/2-(document.getElementById('MSGB_Show').clientWidth)/2;		  
		  document.getElementById('MSGB_Show').style.top=document.getElementById('MSGB_Culmn').offsetTop+10;
		  document.getElementById('MSGB_Show').style.left=document.getElementById('MSGB_Culmn').offsetLeft+5;
		
		$('#div-overlay').css({
                backgroundColor: '#000',
                opacity: 0.8,
                width: arrPageSizes[0],
                height: arrPageSizes[1],
				visibility : 'visible'
            }).fadeIn('slow',function () {
													document.getElementById('MSGB_Show').style.visibility='visible';
													document.getElementById('MSGB_Show').style.display='block';
													});
		
		//--------------------------

   // alert('message_id='+message_id);
	//Process_Loader(td_id,"",'');
   // Set_Content('post','process.php','Pn=Index&mode=GetMessage&Mid='+message_id,true,td_id);
}

//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
function Close_Message()
{
		
	
	
	$('#div-overlay').fadeOut();
	document.getElementById('MSGB_Show').innerHTML='';
	document.getElementById('MSGB_Show').style.visibility='hidden';
	
}

//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------

function Comment_Validating(base_path)
{

	var check=true;
	var css='input_txt';
	var css_error='input_txt_error';	
	var css_error_box='Contact_TD_Error';		
	
	document.getElementById('Msg_Name').className=css;
	document.getElementById('Msg_Email').className=css;
	document.getElementById('Msg_Web').className=css;
	document.getElementById('Msg_Body').className=css;	
	document.getElementById('Msg_Security_Code').className=css;	
	
	if (trim(document.getElementById('Msg_Name').value)=="") 
	{
		document.getElementById('Msg_Name').className=css_error;
		check=false;
	}
	
	var check_email=email_validate(document.getElementById('Msg_Email').value);
	if ((trim(document.getElementById('Msg_Email').value)!="") && check_email==false) 
	{
		document.getElementById('Msg_Email').className=css_error;
		check=false;
	}
	
	
	if (trim(document.getElementById('Msg_Body').value)=="") 
	{
		document.getElementById('Msg_Body').className=css_error;
		check=false;
	}	
	
	if (trim(document.getElementById('Msg_Security_Code').value)=="") 
	{
		document.getElementById('Msg_Security_Code').className=css_error;
		check=false;
	}
	else
	{
		if (document.getElementById('Msg_Security_Code').value.length<5)
		{
			document.getElementById('Msg_Security_Code').className=css_error;
			check=false;
		}
	}


if (check===false)
{
  alert("Error! Please check the highlighted fields. ");
}
else
{

 	var oForm = document.forms.Comment_Box_Form;
	var Request_Query_String=getRequestBody(oForm);
	Process_Loader("Comment_Msg_Box","Please wait. Sending ...",base_path);
	document.getElementById('Msg_Send_Btn').disabled=true;
    Set_Content('post','process.php',Request_Query_String,true,'Comment_List_Td');
    return true;

}

}

//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------

function Msgb_Validating(base_path)
{

	var check=true;
	var css='input_txt';
	var css_error='input_txt_error';	
	var css_error_box='Contact_TD_Error';		
	
	document.getElementById('Msg_Name').className=css;
	document.getElementById('Msg_Email').className=css;
	document.getElementById('Msg_Web').className=css;
	document.getElementById('Msg_Body').className=css;	
	document.getElementById('Msg_Security_Code').className=css;	
	
	if (trim(document.getElementById('Msg_Name').value)=="") 
	{
		document.getElementById('Msg_Name').className=css_error;
		check=false;
	}
	
	var check_email=email_validate(document.getElementById('Msg_Email').value);
	if ((trim(document.getElementById('Msg_Email').value)!="") && check_email==false) 
	{
		document.getElementById('Msg_Email').className=css_error;
		check=false;
	}
	
	
	if (trim(document.getElementById('Msg_Body').value)=="") 
	{
		document.getElementById('Msg_Body').className=css_error;
		check=false;
	}	
	
	if (trim(document.getElementById('Msg_Security_Code').value)=="") 
	{
		document.getElementById('Msg_Security_Code').className=css_error;
		check=false;
	}
	else
	{
		if (document.getElementById('Msg_Security_Code').value.length<5)
		{
			document.getElementById('Msg_Security_Code').className=css_error;
			check=false;
		}
	}


if (check===false)
{
  alert("Error! Please check the highlighted fields. ");
}
else
{

 	var oForm = document.forms.Msgb_Box_Form;
	var Request_Query_String=getRequestBody(oForm);
	Process_Loader("Msgb_Pm_Box","Please wait. Sending ...",base_path);
	document.getElementById('Msg_Send_Btn').disabled=true;
    Set_Content('post','process.php',Request_Query_String,true,'Msgb_List_Td');
    return true;

}

}

//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------

function Load_Media(media_id,FileName,ObjectCode,FromOtherSite)
{ 
		var mbody='';
			mbody+='<table width="90%" align=center border="0" cellspacing="0" cellpadding="0" style="margin-top:10px; margin-bottom:10px">';
			mbody+="<tr><td align=right>";
			mbody+='<A href="javascript:Close_Media();"><img src="theme/english/img/close.png" vspace="2" hspace="2" width="12" height="12" border="0" /></A>'
			mbody+="</td><tr>";
			mbody+="<tr><td valign=middle align=center class=Mtitle style=\"text-align:center\">";
			     var obj1=document.getElementById('MediaFile'+media_id).value;
				 while (obj1.indexOf('***')>-1)	 obj1=obj1.replace('***','"');
				//mbody+='<textarea cols=50 rows=20 >'+obj1+'</textarea>';
				mbody+=obj1;
			
			mbody+="</td></tr>";
								
			mbody+="</table>";		
		
		document.getElementById('Media_Show').innerHTML=mbody;
		//--------------------------
		  var arrPageSizes = __getPageSize();
		  document.getElementById('Media_Show').style.top=arrPageSizes[1]/2- (document.getElementById('Media_Show').clientHeight)/2;
		  document.getElementById('Media_Show').style.left=arrPageSizes[0]/2-(document.getElementById('Media_Show').clientWidth)/2;		  

		
		$('#div-overlay').css({
                backgroundColor: '#000',
                opacity: 0.8,
                width: arrPageSizes[0],
                height: arrPageSizes[1],
				visibility : 'visible'
            }).fadeIn('slow',function () {
													document.getElementById('Media_Show').style.visibility='visible';
													document.getElementById('Media_Show').style.display='block';
													});
		
		//--------------------------

   // alert('message_id='+message_id);
	//Process_Loader(td_id,"",'');
   // Set_Content('post','process.php','Pn=Index&mode=GetMessage&Mid='+message_id,true,td_id);
}

//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
function Close_Media()
{
		
	
	
	$('#div-overlay').fadeOut();
	document.getElementById('Media_Show').innerHTML='';
	document.getElementById('Media_Show').style.visibility='hidden';
	
}

//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------

function Load_PopUp(height1,width1)
{ 
		var mbody='';
			mbody+='<table width="100%" align=center border="0" cellspacing="0" cellpadding="0" >';
			mbody+="<tr><td align=right>";
			mbody+='<A href="javascript:Close_PopUp();"><img src="theme/english/img/close.png" vspace="2" hspace="2" width="12" height="12" border="0" /></A>'
			mbody+="</td><tr>";
			mbody+="<tr><td valign=middle align=center class=Mtitle style=\"text-align:center\">";
			var obj1=document.getElementById('PopUp_Content').value;
				 while (obj1.indexOf('***')>-1)	 obj1=obj1.replace('***','"');
			mbody+=obj1;
			mbody+="</td></tr>";
			mbody+="</table>";		
		
		document.getElementById('PopUp_Box').innerHTML=mbody;
		//--------------------------
		  var arrPageSizes = __getPageSize();
		  var h100=arrPageSizes[1]/2- (height1)/2;
		  if (h100>200)h100=80;
		  document.getElementById('PopUp_Box').style.top=h100;
		  document.getElementById('PopUp_Box').style.left=arrPageSizes[0]/2-(width1)/2;		  
           
		
		$('#div-overlay').css({
                backgroundColor: '#000',
                opacity: 0.8,
                width: arrPageSizes[0],
                height: arrPageSizes[1],
				visibility : 'visible'
            }).fadeIn('slow',function () {
													document.getElementById('PopUp_Box').style.visibility='visible';
													document.getElementById('PopUp_Box').style.display='block';
													});
		
		//--------------------------

  
}

//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
function Close_PopUp()
{
		
	$('#div-overlay').fadeOut();
	document.getElementById('PopUp_Box').innerHTML='';
	document.getElementById('PopUp_Box').style.visibility='hidden';
	
}
