function drop_menu() {
	$('.all_drop').slideUp('fast');	
	$('#menu_menu').slideToggle('fast');
	$('#min').fadeIn('fast');
}
function drop_sub() {
	$('.all_drop').slideUp('fast');	
	$('#menu_sub').slideToggle('fast');
	$('#min').fadeIn('fast');
}
function drop_rempage() {
	$('.all_drop').slideUp('fast');	
	$('#menu_rempage').slideToggle('fast');
	$('#min').fadeIn('fast');
}
function drop_sitesettings() {
	$('.all_drop').slideUp('fast');	
	$('#menu_settings').slideToggle('fast');
	$('#min').fadeIn('fast');
}
function retract_all() {
	$('.all_drop').slideUp('fast');
	$('#min').hide('fast');
	$('#max').fadeIn('slow');
}
function retract_none() {
	$('#menu_menu').slideDown('fast');	
	$('#max').hide('fast');
	$('#min').fadeIn('slow');
}
function drop_pageorder() {
	$('.all_drop').slideUp('fast');	
	$('#menu_orderpage').slideToggle('fast');
	$('#min').fadeIn('fast');
}
function loginshow(){
	$('#loginbox').slideToggle('fast');
	return false;
}
function loginhide(){
	$('#loginbox').slideUp('fast');
	return false;
}
function changepos(newnum) {
	$('#changepos').val(newnum)
}
function confirmorder(delpage) {
	var answer = confirm("Are you sure you wish to delete this page?")
	if (answer){
		window.location = "FCKincludes/fck_delpage.php?del="+delpage;
	}
	else {
		return false;
	}
}

function inp_val() {
	$('#send_val').val('1');
	return true;
}

function losesub() {	
	$('.sub_hold').fadeOut(180);
}
function showsub(divname) {	
	$('.sub_hold').fadeOut(180);
	setTimeout('fadesub("'+divname+'")',180);
}
function fadesub(divname) {
	$('#sub'+divname).fadeIn(180);	
}
function showisparent() {
	$('#add_parent').fadeIn('slow');		
}
function showparent() {
	$('#add_parent').fadeOut('fast');
}
function showadd() {
	$('#showadd').slideToggle('fast');	
}
function showseo(id) {
	$('.seo_all').slideUp('fast');
	$('#seo_'+id).slideToggle('fast');
}
function showallsubs(id) {
	$('#suball'+id).slideToggle('fast');	
}
// NEW STUFF //

function openhelp() {
	$('#helpback').fadeIn('fast');
	$('#helpfront').fadeIn('slow');	
}

function closehelp() {
	$('#helpback').fadeOut('fast');
	$('#helpfront').fadeOut('slow');	
}

function showimg(id) {
	$('#img'+id).slideDown('fast');
	$('#allblack').fadeIn('fast');
}
function hideimg(id) {
	$('#img'+id).slideUp('fast');
	$('#allblack').fadeOut('fast');
}

//////////   STUFF FOR ADMIN ONLY      ////////////////

function showdiv(divname) {	
	$('.hideall').fadeOut(300);
	setTimeout('fadediv("'+divname+'")',300);
}
function fadediv(divname) {
	$('#'+divname).fadeIn(300);	
}


function modchange(catname,catinfo,catid,catparent) {
	$('#catname').val(catname);
	$('#catdesc').val(catinfo);
	$('#catid').val(catid);
	$('#catparent').selectOptions(catparent);
}
/*
function itemchange(itemid) {
	$('.hideitems').fadeOut(300);
	setTimeout('fadeitem("'+itemid+'")',300);
}
*/

function itemchange(itemid) {
	$("#moditnow").html('<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0"><tr><td align="center" valign="middle"><img src="imgs/ajax-loader.gif" /></td></tr></table>');
	$.ajax({ 
	  type: "POST", 
	  url: "modem.php#toppie", 
	  data: "id="+itemid, 
	  success: function(msg){ 
		$("#moditnow").html(msg);
	  } 
	});
	return false;
}


function fadeitem(itemid) {
	$('#itemtable'+itemid).fadeIn(300);
}

function shoord(ordername) {
	$('.FTCLOSE').slideUp('fast');
	
	
	$('#ord_'+ordername).slideToggle('fast');	
}
function changeimg(imgsrc,peefix) {
	$('#mainimg').src(peefix+"userfiles/image/"+imgsrc);
}
function price(num) {
	if(num == 1) {
		$('#p_2').val('');
		$('#p_2').attr('disabled','disabled');
		$('#p_3').val('');
		$('#p_3').attr('disabled','disabled');
		$('#p_4').val('');
		$('#p_4').attr('disabled','disabled');
		$('#p_5').val('');
		$('#p_5').attr('disabled','disabled');
		$('#p_1').removeAttr('disabled');
	}else if(num == 2) {
		$('#p_1').val('');
		$('#p_1').attr('disabled','disabled');
		$('#p_2').removeAttr('disabled');
		$('#p_3').removeAttr('disabled');
		$('#p_4').removeAttr('disabled');
		$('#p_5').removeAttr('disabled');
	}
}
function samedel() {
	flag = $('#samedelonoff').val();
	name = $('#check_name').val();
	company = $('#check_company').val();
	address = $('#check_address').val();
	suburb = $('#check_suburb').val();
	city = $('#check_city').val();
	postcode = $('#check_postcode').val();
	
	if(flag==1) {
		$('#samedelonoff').val(2);
		$('#d_1').val(name);
		$('#d_1').attr('disabled','disabled');	
		$('#d_2').val(company);
		$('#d_2').attr('disabled','disabled');
		$('#d_3').val(address);
		$('#d_3').attr('disabled','disabled');
		$('#d_4').val(suburb);
		$('#d_4').attr('disabled','disabled');
		$('#d_5').val(postcode);
		$('#d_5').attr('disabled','disabled');
		$('#d_6').selectOptions(city);
		$('#d_6').attr('disabled','disabled');
	}else{
		$('#samedelonoff').val(1);
		$('#d_1').val('');
		$('#d_1').attr('disabled','');
		$('#d_2').val('');
		$('#d_2').attr('disabled','');
		$('#d_3').val('');
		$('#d_3').attr('disabled','');
		$('#d_4').val('');
		$('#d_4').attr('disabled','');
		$('#d_5').val('');
		$('#d_5').attr('disabled','');
		$('#d_6').attr('disabled','');
	}
}

function checkoutval() {
	c_type = $('#check_type').val();
	
	c_email = $('#check_email').val();
	c_name = $('#check_name').val();
	c_address = $('#check_address').val();
	c_suburb = $('#check_suburb').val();
	c_postcode = $('#check_postcode').val();
	c_phone = $('#check_phone').val();
	
	d_name = $('#d_1').val();
	d_address = $('#d_3').val();
	d_suburb = $('#d_4').val();
	d_postcode = $('#d_5').val();
	
	if(c_type==3) {
		if(c_email.length==0) {	
			$('#check_email').css('border-color','#EB2127');
			$('#check_email').css('border-width','medium');
			return false;
		}
	}
	
	if(c_type==1 || c_type==3) {
		if(c_name.length==0) {	
			$('#check_name').css('border-color','#EB2127');
			$('#check_name').css('border-width','medium');
			return false;
		} else if(c_address.length==0) {	
			$('#check_address').css('border-color','#EB2127');
			$('#check_address').css('border-width','medium');
			return false;	
		} else if(c_suburb.length==0) {	
			$('#check_suburb').css('border-color','#EB2127');
			$('#check_suburb').css('border-width','medium');
			return false;	
		} else if(c_postcode.length==0) {	
			$('#check_postcode').css('border-color','#EB2127');
			$('#check_postcode').css('border-width','medium');
			return false;	
		} else if(c_phone.length==0) {	
			$('#check_phone').css('border-color','#EB2127');
			$('#check_phone').css('border-width','medium');
			return false;
		}
	}
	
	if(d_name.length==0) {	
		$('#d_1').css('border-color','#EB2127');
		$('#d_1').css('border-width','medium');
		return false;
	} else if(d_address.length==0) {	
		$('#d_3').css('border-color','#EB2127');
		$('#d_3').css('border-width','medium');
		return false;
	} else if(d_suburb.length==0) {	
		$('#d_4').css('border-color','#EB2127');
		$('#d_4').css('border-width','medium');
		return false;
	} else if(d_postcode.length==0) {	
		$('#d_5').css('border-color','#EB2127');
		$('#d_5').css('border-width','medium');
		return false;
	} else {
		return true;	
	}
}

test = '';

function registerval() {
	r_email = $('#reg_email').val();
	r_pw = $('#reg_password').val();
	r_pwc = $('#reg_confirm').val();
	
	r_first = $('#reg_first').val();
	r_last = $('#reg_last').val();
	r_address = $('#reg_address').val();
	r_suburb = $('#reg_suburb').val();
	r_postcode = $('#reg_postcode').val();
	r_city = $('#reg_city').val();
	r_phone = $('#reg_phone').val();
	
	test = '';
	
	if(r_email.length > 0) {	
		$.ajax({ 
		  async: false,
		  type: "POST", 
		  url: "/find_user.php", 
		  data: "email="+r_email, 
		  success: function(msg){
			$("#user_avail").html(msg);
			test = msg;
		  } 
		});
	}
	
	if(r_email.length==0) {	
		$('#reg_email').css('border-color','#EB2127');
		$('#reg_email').css('border-width','medium');
		return false;
	} else if(test == 'NOT AVAILABLE') {
		$('#reg_email').css('border-color','#EB2127');
		$('#reg_email').css('border-width','medium');
		return false;
	} else if(r_pw.length==0) {	
		$('#reg_password').css('border-color','#EB2127');
		$('#reg_password').css('border-width','medium');
		return false;
	} else if((r_pwc.length==0)||(r_pwc != r_pw)) {	
		$('#reg_confirm').css('border-color','#EB2127');
		$('#reg_confirm').css('border-width','medium');
		return false;
	} else if(r_first.length==0) {	
		$('#reg_first').css('border-color','#EB2127');
		$('#reg_first').css('border-width','medium');
		return false;
	} else if(r_last.length==0) {	
		$('#reg_last').css('border-color','#EB2127');
		$('#reg_last').css('border-width','medium');
		return false;
	} else if(r_address.length==0) {	
		$('#reg_address').css('border-color','#EB2127');
		$('#reg_address').css('border-width','medium');
		return false;
	} else if(r_suburb.length==0) {	
		$('#reg_suburb').css('border-color','#EB2127');
		$('#reg_suburb').css('border-width','medium');
		return false;
	} else if(r_postcode.length==0) {	
		$('#reg_postcode').css('border-color','#EB2127');
		$('#reg_postcode').css('border-width','medium');
		return false;
	} else if(r_city == 'PLEASE SELECT ONE') {	
		$('#reg_city').css('border-color','#EB2127');
		$('#reg_city').css('border-width','medium');
		return false;
	} else if(r_phone.length==0) {	
		$('#reg_phone').css('border-color','#EB2127');
		$('#reg_phone').css('border-width','medium');
		return false;
	} else {
		return true;	
	}
}
function toggleorders(id) {
	$('.allordees').slideUp('fast');	
	$('#ordee'+id).slideDown('fast');
	return false;
}

