// JavaScript Document
// JavaScript Document
// JavaScript Document
//For the Miles and zipcode validation.
function check_zipcode(formname)
{
	if(document.getElementById(formname.name).Miles.value!=0)
	{
		if(document.getElementById(formname.name).ZipCode.value=="")
		{		
			alert("Please Enter Value of Zip code");
			return false;
		}
		else
			return true;
	}
	else
		return true;
}
// -----Chage The Status-------
function chagestatus(formname,file,id,val)
{
	document.getElementById(formname.name).Process.value="STATUS";
	document.getElementById(formname.name).ID.value=id;
	document.getElementById(formname.name).action  = file+".php?val="+val;
	document.getElementById(formname.name).submit();
}

// -----Chage Admin Type For Admin-------
function chagestatus_type(formname,file,id,statusvalue,val)
{
	document.getElementById(formname.name).Process.value=statusvalue;
	document.getElementById(formname.name).type_status.value=val;
	document.getElementById(formname.name).ID.value=id;
	document.getElementById(formname.name).action  = file+".php";
	document.getElementById(formname.name).submit();
}
//--- Go Back To File -----
function goback()
{
	history.go(-1);
}
//--- Sorting The Record -----
function sortdata(file,OrderBy,OrderType,Keyword,Type,FieldName,Page,PerPageLimit)
{
	window.location="index.php?p="+file+"&OrderBy="+OrderBy+"&OrderType="+OrderType+"&Keyword="+Keyword+"&FieldName="+FieldName+"&Type="+Type+"&Page="+Page+"&PerPageLimit="+PerPageLimit;
}
//--- Add Page For The Record -----
function add(file,PerPageLimit,Page)
{
		window.location="index.php?p="+file+"&var="+PerPageLimit+"&Page="+Page+"&MODE=ADD";
}
//--- Edit Page for The  Record -----
function edit(file,id)
{
	window.location="index.php?p="+file+"&ID="+id+"&MODE=UPDATE";
}
//-----Detail of the page-------
function detail(file,id)
{
	window.location="index.php?p="+file+"&ID="+id;
}
//--- Search For The Show All Record -----
function searchshowall(file,PerPageLimit,RefferenceID)
{
	window.location="index.php?p="+file+"&PerPageLimit="+PerPageLimit+"&ProductID="+RefferenceID;
}
//--- Search For The Record For Go Button-----
function searchgo(formname,file)
{
	document.getElementById(formname.name).action  = "index.php?p="+file;
	document.getElementById(formname.name).submit();
}
//---------------  Change Per Page limit ----------------
function changeperPage(PerPageLimit,formname,file)
{
		document.getElementById(formname.name).action  = "index.php?p="+file+"&PerPageLimit="+PerPageLimit;
		document.getElementById(formname.name).submit();
}
//------------------  Change Display Page -----------------------
function changeDisplayPage(PageNo,formname,file)
{	
	document.getElementById(formname.name).Page.value=PageNo;
	document.getElementById(formname.name).action  = "index.php?p="+file;
	document.getElementById(formname.name).submit();
}
// --------------- Confirm Delete alert Message ------------------
function confirmDel(formname,ID,Process,managefile)
{
	if(Process=="DELETE")
		{
			if(confirm("Do you really want to delete?"))
			{
				document.getElementById(formname.name).Process.value=Process;
				document.getElementById(formname.name).ID.value=ID;
				document.getElementById(formname.name).action  = managefile+".php";
				document.getElementById(formname.name).submit();
				return true;
			}
			else
				return false;
		}
		else
		{
			var ellen=document.getElementById(formname.name).elements.length;
			var count=0;
			for(var i=1;i<ellen;i++)
			{
				if(document.getElementById(formname.name).elements[i].name=="del[]")
				{
					 if(document.getElementById(formname.name).elements[i].checked==true)
						count=count+1;
				}
			}
				if(count==0)
				{
					alert("Please Select Record To Delete");
					return false;
				}
				else
				{
					if(confirm("Do you really want to delete?"))
					{
						
					document.getElementById(formname.name).Process.value=Process;
					document.getElementById(formname.name).ID.value=ID;
					document.getElementById(formname.name).action  = managefile+".php";
					document.getElementById(formname.name).submit();
						return true;
					}
					else
						return false;
				}
	}
}
function confirmDelSimple(formname,Process,managefile)
{
	var ellen=document.getElementById(formname).elements.length;
	var count=0;
	for(var i=0;i<ellen;i++)
	{
		if(document.getElementById(formname).elements[i].name=="del[]")
		{	
			 if(document.getElementById(formname).elements[i].checked==true)
			 {
				count=count+1;
			 }
		}
	}
		if(count==0)
		{
			alert("Please Select Record To Delete");
			return false;
		}
		else
		{
			if(confirm("Do you really want to delete?"))
			{
				
			document.getElementById(formname).Process.value=Process;
			document.getElementById(formname).action  = managefile+".php";
			document.getElementById(formname).submit();
				return true;
			}
			else
				return false;
		}
}

// to send message to multiple person 
function confirmSendMessage(formname,Process,managefile)
{

	var ellen=document.getElementById(formname).elements.length;
	var count=0;
	for(var i=0;i<ellen;i++)
	{
		if(document.getElementById(formname).elements[i].name=="send[]")
		{	
			 if(document.getElementById(formname).elements[i].checked==true)
			 {
				count=count+1;
			 }
		}
	}
		if(count==0)
		{
			alert("Please Select Record To Send Message");
			return false;
		}
		else
		{
			document.getElementById(formname).Process.value=Process;
			document.getElementById(formname).action  ="index.php?p="+managefile;
			document.getElementById(formname).submit();
			return true;
		}
}


// ------------------- Check All and Uncheck All -----------------------
function check_all(Form_Obj,eventgiver){
		var ellen=Form_Obj.elements.length;
		if(eventgiver.checked==true){
			for(var i=1;i<ellen;i++){
				if(Form_Obj.elements[i].name=="del[]")
				Form_Obj.elements[i].checked=true;
			}
		}else if(eventgiver.checked==false){
			for(var i=1;i<ellen;i++){
				if(Form_Obj.elements[i].name=="del[]")
				Form_Obj.elements[i].checked=false;
			}
		}
}
//-----window open
function winpopup(url,width,height)
{

window.open(url,'','location=0,menubar=0,titlebar=0,toolbar=0,resizable=1,scrollbar=1,status=0,height='+height+',width='+width+',top=155,left=155');
//window.open(url);
}
//--- Fetching State of Country  Thourhg Ajax
function get_state(File_Path,ID,Table,Data_Name,Data_Value,Search,Option,Load)
{
/*	alert(File_Path);
	alert(ID);
	alert(Table);
	alert(Data_Name);
	alert(Data_Value);
	alert(Search);
	alert(Option);
	alert(Load);
*/	if(ID!="other")
	{

		fetch_remote_page(File_Path+"?ID="+ID+"&Table="+Table+"&Data_Name="+Data_Name+"&Data_Value="+Data_Value+"&Search="+Search+"&Load="+Load,Option);	
	
	}
}
function get_selected_state(File_Path1,ID,Table,Data_Name,Data_Value,StateIDSelected,Search,Option,Load)
{
	if(ID!="other")
	{
		
		fetch_remote_page(File_Path1+"?ID="+ID+"&Table="+Table+"&Data_Name="+Data_Name+"&Data_Value="+Data_Value+"&StateIDSelected="+StateIDSelected+"&Search="+Search+"&Load="+Load,Option);		
	
	}
}
/*function get_selected_currency(File_Path1,ID,Table,Data_Name,Data_Value,StateIDSelected,Search,Option)
{
	if(ID!="other")
	{
		
		fetch_remote_page(File_Path+"?ID="+ID+"&Search="+Search+"&Option="+Option,Option);		
	
	}
}*/

function get_state_currency(File_Path,ID,Search,Option)
{
	
	if(ID!="other")
	{
		
		fetch_remote_page(File_Path+"?ID="+ID+"&Search="+Search+"&Option="+Option,Option);	
	
	}
}
// for setting particular use as oflile
function set_member_offline(File_Path,Option,UserRegistrationID)
{
	fetch_remote_page(File_Path+"?UserRegistrationID="+UserRegistrationID+"&Action="+Option,Option);	
}
//--- Showing and Hiding row
function show_hide_row(ID,TrID)
{

	if(ID=='other')
		document.getElementById(TrID).style.display="";
	else
		document.getElementById(TrID).style.display="none";
	
}
function submit_form(formname,file)
{
	document.getElementById(formname.name).action=file;
}
function showTbl(Style,ID){

	if(Style == 'show')

			document.getElementById(ID).style.display = '';
	else if(Style == 'hide')
			document.getElementById(ID).style.display = 'none';
}
//--- checking Authority to done any task and select data
function checking_authority(formname,val,message)
{
	if(val==0)
	{
		alert(message);
		return false;
	}
	else
	{
		return false;
	}
}
function network_checking_authority(formname,val,message,Process,managefile)
{
	if(val==0)
	{
		alert(message);
		return false;
	}
	else
	{
		var ellen=document.getElementById(formname).elements.length;
		var count=0;
		for(var i=0;i<ellen;i++)
		{
			if(document.getElementById(formname).elements[i].name=="send[]")
			{	
				 if(document.getElementById(formname).elements[i].checked==true)
				 {
					count=count+1;
				 }
			}
		}
			if(count==0)
			{
				alert("Please Select Record To Send Message");
				return false;
			}
			else
			{
				document.getElementById(formname).Process.value=Process;
				document.getElementById(formname).action  ="index.php?p="+managefile;
				document.getElementById(formname).submit();
				return true;
			}
	}
}
//--- cehckinh Authority only
function checking_authority_only(formname,val,message)
{
	if(val==0)
	{
		alert(message);
		return false;
	}
	else
		return true;
}
//-- Selecting Accept Or Reject
function AcceptReject(formname,IDvalue,managefile)
{
	document.getElementById(formname).ID.value=IDvalue;
	document.getElementById(formname).action  = managefile+".php";
	document.getElementById(formname).submit();
}
//--giving format of date 
function check_date(val,formatdate)
{
	if(val=='Date' || val=='PressReleaseDate' || val=='NewsDate' || val=='JobPostDate' || val=='ResumePostDate' || val=='ClassfiedItemDate')
		document.getElementById(formatdate).style.display='';
	else
		document.getElementById(formatdate).style.display='none';
}
//--Select The Membership type for promotion 

function get_membertype(File_Path,ID,Table,Data_Name,Data_Value,Search,Option)
{
	//alert('imfunsfsdfsdf');
	//alert(File_Path);
	//	alert(ID);
	//	alert(File_Path+"?ID="+ID+"&Table="+Table+"&Data_Name="+Data_Name+"&Data_Value="+Data_Value+"&Search="+Search,Option);
/*	alert(File_Path);
	alert(ID);
	alert(Table);
	alert(Data_Name);
	alert(Data_Value);
	alert(Search);
	alert(Option);
	alert(File_Path+"?ID="+ID+"&Table="+Table+"&Data_Name="+Data_Name+"&Data_Value="+Data_Value+"&Search="+Search,Option);*/

		
		fetch_remote_page(File_Path+"?ID="+ID+"&Table="+Table+"&Data_Name="+Data_Name+"&Data_Value="+Data_Value+"&Search="+Search,Option);	
	
	
}

