// JavaScript Document

// JavaScript Document

/************************************Address Manager***********************************/
var float =/^(\+?((([0-9]+(\.)?)|([0-9]*\.[0-9]+))([eE][+-]?[0-9]+)?))$/;


function Inint_AJAX() {
   try { return new ActiveXObject("Msxml2.XMLHTTP");  } catch(e) {} //IE
   try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {} //IE
   try { return new XMLHttpRequest();          } catch(e) {} //Native Javascript
   alert("XMLHttpRequest not supported");
   return null;
};



/***********************************************User Manager*************************************/
function user_edit(admin_id,page,limit)
{
	document.frm_user_mgmt.action="user_add.php?admin_id="+admin_id+"&page="+page+"&limit="+limit;
	document.frm_user_mgmt.submit();
}
function user_delete(user_id,page,limit)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{
		document.frm_user_mgmt.action="user_delete.php?admin_id="+admin_id+"&page="+page+"&limit="+limit;
		document.frm_user_mgmt.submit();	
	}
}

var int =/^\d+$/;
var float =/^(\+?((([0-9]+(\.)?)|([0-9]*\.[0-9]+))([eE][+-]?[0-9]+)?))$/;
function user_save(page,limit)
{
	document.frm_user_add.action="user_save.php?page="+page+"&limit="+limit;
		document.frm_user_add.submit();
	
}
/***********************************************Customer Manager*************************************/
function customer_edit(customer_id,page,limit)
{
	document.frm_customer_mgmt.action="customer_add.php?customer_id="+customer_id+"&page="+page+"&limit="+limit;
	document.frm_customer_mgmt.submit();
}
function customer_delete(customer_id,page,limit)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{
		document.frm_customer_mgmt.action="customer_delete.php?customer_id="+customer_id+"&page="+page+"&limit="+limit;
		document.frm_customer_mgmt.submit();	
	}
}

var int =/^\d+$/;
var float =/^(\+?((([0-9]+(\.)?)|([0-9]*\.[0-9]+))([eE][+-]?[0-9]+)?))$/;
function customer_save(page,limit)
{
	document.frm_customer_add.action="customer_save.php?page="+page+"&limit="+limit;
		document.frm_customer_add.submit();
	
}
/***********************************************Company Manager*************************************/
function company_edit(company_id,page,limit)
{
	document.frm_company_mgmt.action="company_add.php?company_id="+company_id+"&page="+page+"&limit="+limit;
	document.frm_company_mgmt.submit();
}
function company_delete(company_id,page,limit)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{
		document.frm_company_mgmt.action="company_delete.php?company_id="+company_id+"&page="+page+"&limit="+limit;
		document.frm_company_mgmt.submit();	
	}
}

var int =/^\d+$/;
var float =/^(\+?((([0-9]+(\.)?)|([0-9]*\.[0-9]+))([eE][+-]?[0-9]+)?))$/;
function company_save(page,limit)
{
	document.frm_company_add.action="company_save.php?page="+page+"&limit="+limit;
		document.frm_company_add.submit();
	
}
/*****************************************Category Manager*****************************************/

function category_edit(category_id,page,limit)
{
	document.frm_category_mgmt.action="category_add.php?category_id="+category_id+"&page="+page+"&limit="+limit;
	document.frm_category_mgmt.submit();
}
function category_delete(category_id,page,limit)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{
		document.frm_category_mgmt.action="category_delete.php?category_id="+category_id+"&page="+page+"&limit="+limit;
		document.frm_category_mgmt.submit();	
	}
}

function category_save(page,limit)
{
	document.frm_category_add.action="category_save.php?page="+page+"&limit="+limit;
		document.frm_category_add.submit();
	
}
/*****************************************Testimonial Manager*****************************************/

function testimonial_edit(testimonial_id,page,limit)
{
	document.frm_testimonial_mgmt.action="testimonial_add.php?testimonial_id="+testimonial_id+"&page="+page+"&limit="+limit;
	document.frm_testimonial_mgmt.submit();
}
function testimonial_delete(testimonial_id,page,limit)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{
		document.frm_testimonial_mgmt.action="testimonial_delete.php?testimonial_id="+testimonial_id+"&page="+page+"&limit="+limit;
		document.frm_testimonial_mgmt.submit();	
	}
}

function testimonial_save(page,limit)
{
	document.frm_testimonial_add.action="testimonial_save.php?page="+page+"&limit="+limit;
		document.frm_testimonial_add.submit();
	
}
/*****************************************Suburb Manager*****************************************/

function suburb_edit(suburb_id,page,limit)
{
	document.frm_suburb_mgmt.action="suburb_add.php?suburb_id="+suburb_id+"&page="+page+"&limit="+limit;
	document.frm_suburb_mgmt.submit();
}
function suburb_delete(suburb_id,page,limit)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{
		document.frm_suburb_mgmt.action="suburb_delete.php?suburb_id="+suburb_id+"&page="+page+"&limit="+limit;
		document.frm_suburb_mgmt.submit();	
	}
}

function suburb_save(page,limit)
{
	document.frm_suburb_add.action="suburb_save.php?page="+page+"&limit="+limit;
		document.frm_suburb_add.submit();
	
}

/*****************************************Credit Manager*****************************************/

function credit_edit(credit_id,page,limit)
{
	document.frm_credit_mgmt.action="credit_add.php?credit_id="+credit_id+"&page="+page+"&limit="+limit;
	document.frm_credit_mgmt.submit();
}
function credit_delete(credit_id,page,limit)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{
		document.frm_credit_mgmt.action="credit_delete.php?credit_id="+credit_id+"&page="+page+"&limit="+limit;
		document.frm_credit_mgmt.submit();	
	}
}

function credit_save(page,limit)
{
	document.frm_credit_add.action="credit_save.php?page="+page+"&limit="+limit;
		document.frm_credit_add.submit();
	
}
/********************************************Page Manager**************************************/

function page_edit(page_id,page,limit)
{
	document.frm_page_mgmt.action="page_add.php?page_id="+page_id+"&page="+page+"&limit="+limit;
	document.frm_page_mgmt.submit();
}

function page_delete(page_id,page,limit)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{
		document.frm_page_mgmt.action="page_delete.php?page_id="+page_id+"&page="+page+"&limit="+limit;
		document.frm_page_mgmt.submit();	
	}
}

function page_save(page,limit,page_id,image)
{	
		document.frm_page_add.action="page_save.php?page="+page+"&limit="+limit;
		document.frm_page_add.submit();
}

/********************************************Class Manager**************************************/

function class_edit(class_id,page,limit)
{
	document.frm_class_mgmt.action="class_add.php?class_id="+class_id+"&page="+page+"&limit="+limit;
	document.frm_class_mgmt.submit();
}

function class_delete(class_id,page,limit)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{
		document.frm_class_mgmt.action="class_delete.php?class_id="+class_id+"&page="+page+"&limit="+limit;
		document.frm_class_mgmt.submit();	
	}
}

function class_save(page,limit,class_id,image)
{	
		document.frm_class_add.action="class_save.php?page="+page+"&limit="+limit;
		document.frm_class_add.submit();
}

/********************************************Video Manager**************************************/

function video_edit(video_id,page,limit)
{
	document.frm_video_mgmt.action="video_add.php?video_id="+video_id+"&page="+page+"&limit="+limit;
	document.frm_video_mgmt.submit();
}

function video_delete(video_id,page,limit)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{
		document.frm_video_mgmt.action="video_delete.php?video_id="+video_id+"&page="+page+"&limit="+limit;
		document.frm_video_mgmt.submit();	
	}
}

function video_save(page,limit,class_id,image)
{	
		document.frm_video_add.action="video_save.php?page="+page+"&limit="+limit;
		document.frm_video_add.submit();
}


function instructor_save(page,limit,class_id,image)
{	
		document.frm_my_account.action="instructor_save_class.php?page="+page+"&limit="+limit;
		document.frm_my_account.submit();
}

/********************************************Press Manager**************************************/

function press_save(page,limit)
{	
		document.frm_press_add.action="press_save.php?page="+page+"&limit="+limit;
		document.frm_press_add.submit();
}

function press_edit(press_id,page,limit)
{
	document.frm_press_mgmt.action="press_add.php?press_id="+press_id+"&page="+page+"&limit="+limit;
	document.frm_press_mgmt.submit();
}

function press_delete(press_id,page,limit)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{
		document.frm_press_mgmt.action="press_delete.php?press_id="+press_id+"&page="+page+"&limit="+limit;
		document.frm_press_mgmt.submit();	
	}
}

/********************************************Routine Manager**************************************/

function routine_edit(routine_id,page,limit)
{
	document.frm_routine_mgmt.action="routine_add.php?routine_id="+routine_id+"&page="+page+"&limit="+limit;
	document.frm_routine_mgmt.submit();
}

function routine_delete(routine_id,page,limit)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{
		document.frm_routine_mgmt.action="routine_delete.php?routine_id="+routine_id+"&page="+page+"&limit="+limit;
		document.frm_routine_mgmt.submit();	
	}
}

function routine_save(page,limit)
{	
		document.frm_routine_add.action="routine_save.php?page="+page+"&limit="+limit;
		document.frm_routine_add.submit();
}

/********************************************Fitness Manager**************************************/

function fitness_edit(routine_id,page,limit)
{
	document.frm_routine_mgmt.action="fitness_add.php?routine_id="+routine_id+"&page="+page+"&limit="+limit;
	document.frm_routine_mgmt.submit();
}

function fitness_delete(routine_id,page,limit)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{
		document.frm_routine_mgmt.action="fitness_delete.php?routine_id="+routine_id+"&page="+page+"&limit="+limit;
		document.frm_routine_mgmt.submit();	
	}
}

function fitness_save(page,limit)
{	
		document.frm_routine_add.action="fitness_save.php?page="+page+"&limit="+limit;
		document.frm_routine_add.submit();
}

/********************************************Testimonial Manager**************************************/

function testi_edit(press_id,page,limit)
{
	document.frm_testimonial_mgmt.action="testimonial_add.php?press_id="+press_id+"&page="+page+"&limit="+limit;
	document.frm_testimonial_mgmt.submit();
}

function testi_delete(press_id,page,limit)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{
		document.frm_testimonial_mgmt.action="testimonial_delete.php?press_id="+press_id+"&page="+page+"&limit="+limit;
		document.frm_testimonial_mgmt.submit();	
	}
}

function testi_save(page,limit)
{	
		document.frm_testimonial_add.action="testimonial_save.php?page="+page+"&limit="+limit;
		document.frm_testimonial_add.submit();
}

/*****************************************Instructor Manager*****************************************/

function instructor_edit(user_login_id,page,limit)
{
	document.frm_instructor_mgmt.action="instructor_add.php?user_login_id="+user_login_id+"&page="+page+"&limit="+limit;
	document.frm_instructor_mgmt.submit();
}
function instructor_delete(user_login_id,page,limit)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{
		document.frm_instructor_mgmt.action="instructor_delete.php?user_login_id="+user_login_id+"&page="+page+"&limit="+limit;
		document.frm_instructor_mgmt.submit();	
	}
}

function instructor_save(page,limit)
{
	document.frm_instuctor_add.action="instructor_save.php?page="+page+"&limit="+limit;
		document.frm_instuctor_add.submit();
	
}

/*****************************************Class Type Manager*****************************************/

function class_type_edit(class_type_id,page,limit)
{
	document.frm_class_type_mgmt.action="class_type_add.php?class_type_id="+class_type_id+"&page="+page+"&limit="+limit;
	document.frm_class_type_mgmt.submit();
}
function class_type_delete(class_type_id,page,limit)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{
		document.frm_class_type_mgmt.action="class_type_delete.php?class_type_id="+class_type_id+"&page="+page+"&limit="+limit;
		document.frm_class_type_mgmt.submit();	
	}
}

function class_type_save(page,limit)
{
	document.frm_class_type_add.action="class_type_save.php?page="+page+"&limit="+limit;
	document.frm_class_type_add.submit();
	
}

/*****************************************Workshop Manager*****************************************/

function workshop_edit(workshop_id,page,limit)
{
	document.frm_workshop_mgmt.action="workshop_add.php?workshop_id="+workshop_id+"&page="+page+"&limit="+limit;
	document.frm_workshop_mgmt.submit();
}
function workshop_delete(workshop_id,page,limit)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{
		document.frm_workshop_mgmt.action="workshop_delete.php?workshop_id="+workshop_id+"&page="+page+"&limit="+limit;
		document.frm_workshop_mgmt.submit();	
	}
}

function workshop_save(page,limit)
{
	document.frm_workshop_add.action="workshop_save.php?page="+page+"&limit="+limit;
	document.frm_workshop_add.submit();
	
}

/********************************************Rate Manager**************************************/

function rate_edit(instructor_rating_id,page,limit)
{
	document.frm_rate_mgmt.action="rate_add.php?instructor_rating_id="+instructor_rating_id+"&page="+page+"&limit="+limit;
	document.frm_rate_mgmt.submit();
}

function rate_delete(instructor_rating_id,page,limit)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{
		document.frm_rate_mgmt.action="rate_delete.php?instructor_rating_id="+instructor_rating_id+"&page="+page+"&limit="+limit;
		document.frm_rate_mgmt.submit();	
	}
}

function rate_save(page,limit)
{	
		document.frm_rate_add.action="rate_save.php?page="+page+"&limit="+limit;
		document.frm_rate_add.submit();
}

/********************************************E-Mail Manager**************************************/

function email_edit(page_id,page,limit)
{
	document.frm_email_mgmt.action="email_add.php?page_id="+page_id+"&page="+page+"&limit="+limit;
	document.frm_email_mgmt.submit();
}

function email_delete(page_id,page,limit)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{
		document.frm_email_mgmt.action="email_delete.php?page_id="+page_id+"&page="+page+"&limit="+limit;
		document.frm_email_mgmt.submit();	
	}
}

function email_save(page,limit)
{	
		document.frm_email_add.action="email_save.php?page="+page+"&limit="+limit;
		document.frm_email_add.submit();
}


function getcategory(val) {
     var req = Inint_AJAX();
		req.onreadystatechange = function () { 
	       if (req.readyState==4) {
	          if (req.status==200) {
	             document.getElementById("tdcat").innerHTML=req.responseText; //retuen value
              } 
           }
        };
	 req.open("GET", "../getcategory.php?val="+val+"&type=cat"); //make connection
	 
	 req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=iso-8859-1"); // set Header
     req.send(null); //send value
};


function getsuburborder(val) {
     var req = Inint_AJAX();
		req.onreadystatechange = function () { 
	       if (req.readyState==4) {
	          if (req.status==200) {
	             document.getElementById("tdsorder").innerHTML=req.responseText; //retuen value
              } 
           }
        };
	 req.open("GET", "../getcategory.php?val="+val+"&type=sorder"); //make connection
	 
	 req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=iso-8859-1"); // set Header
     req.send(null); //send value
};


function getpostcode(val) {
     var req = Inint_AJAX();
		req.onreadystatechange = function () { 
	       if (req.readyState==4) {
	          if (req.status==200) {
	             document.getElementById("tdpost").innerHTML=req.responseText; //retuen value
              } 
           }
        };
	 req.open("GET", "../getcategory.php?val="+val+"&type=post"); //make connection
	 
	 req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=iso-8859-1"); // set Header
     req.send(null); //send value
};

function getuserform(value)
{
	   var req = Inint_AJAX();
		req.onreadystatechange = function () { 
	       if (req.readyState==4) {
	          if (req.status==200) {
	             document.getElementById("tdnew").innerHTML=req.responseText; //retuen value
              } 
           }
        };
	 req.open("GET", "userform.php?val="+value); //make connection
	 
	 req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=iso-8859-1"); // set Header
     req.send(null); //send value
}

function login_validate()
{
	var email=document.frmquotes.email.value;
	var password=document.frmquotes.password1.value;
	   var req = Inint_AJAX();
		req.onreadystatechange = function () { 
	       if (req.readyState==4) {
	          if (req.status==200) {
				 
	             document.getElementById("tdlogin").innerHTML=req.responseText; //retuen value
              } 
           }
        };
	 req.open("GET", "login_validate.php?email="+email+"&password="+password); //make connection
	 
	 req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=iso-8859-1"); // set Header
     req.send(null); //send value
}

function getsuburb(value)
{
	   var req = Inint_AJAX();
		req.onreadystatechange = function () { 
	       if (req.readyState==4) {
	          if (req.status==200) {
	             document.getElementById("tdsuburb").innerHTML=req.responseText; //retuen value
              } 
           }
        };
	 req.open("GET", "getsuburb.php?postcode="+value); //make connection
	 
	 req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=iso-8859-1"); // set Header
     req.send(null); //send value
}

function checkemail(value,type,action,field)
{
		if(action=="save" && field=="email" && type=="company")
		{
				document.frmcompany.login_name.value=value;
		}
	   var req = Inint_AJAX();
		req.onreadystatechange = function () { 
	       if (req.readyState==4) {
	          if (req.status==200) {
				  if(field=="email")
				  {
	             	document.getElementById("tdemail").innerHTML=req.responseText; //retuen value
				  }
				  else
				  {
					  document.getElementById("tdlogin").innerHTML=req.responseText; //retuen value
				  }
              } 
           }
        };
	 req.open("GET", "check_email.php?value="+value+"&type="+type+"&action="+action+"&field="+field); //make connection
	 
	 req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=iso-8859-1"); // set Header
     req.send(null); //send value
}
function markquote(qid)
{
	var ans=confirm("Quote will expire after you mark it completed.r u want to continue?");
	if(ans==true)
	{
		window.location="quote_completed.php?quote_id="+qid;
	}
}

function emailLink() {
	window.location = "mailto:?SUBJECT=A%20Link%20From%20A%20Friend&BODY=I%20found%20this%20site%20and%20thought%20that%20you%20might%20like%20it%3A%0D%0Ahttp%3A%2F%2Fwww.ozziequotes.com%2F%0D%0A%0D%0Aozziequotes.com%20offers%20the%20most%20up%20to%20date%20and%20comprehensive%20nationwide%20search%20engine%20of%20full%20service%20of%20submitting%20quotes.";
}

