

function showLayer(formData, jqForm, options){

	//$('#loading').show();
}


function hideLayer() {
	$('#loading').hide();
}

function showResponse(responseText, statusText)  {

	//setTimeout('hideLayer()', 500);
	//$("#layout_content").html(responseText);
	
}


function doAjax(_url) {
	showLayer();

	$(document).ready(function() {
		var _html = $.ajax({
		  url: _url,
		  async: false
		}).responseText;

		showResponse(_html)
	});
}




function submitPerAjax(form_id){
	$('#'+form_id).ajaxSubmit({success:showResponse, beforeSubmit:showLayer});
}


function changeelms(_number) {
	
	for(i=1; i<=6; i++) {
		$("#package_"+i).attr("checked",false);
		$("#order-radio"+i).show();
		$("#order-radioact"+i).hide();
		/*$("#order-radio"+i).attr("style","background: url(/images/order-radio-unchecked.png) no-repeat;");
		$("#t"+i+"_u").attr("class", "description");
		$("#t"+i+"_o").attr("class", "description");*/
	}
	
	$("#package_"+_number).attr("checked",true);
	//$("#order-radio"+_number).attr("style","background: url(/images/order-radio-checked.png) no-repeat;");
	$("#order-radio"+_number).hide();
	$("#order-radioact"+_number).toggle();
	//alert ("#order-radioact"+_number);
	/*$("#t"+_number+"_u").attr("class", "choice");
	$("#t"+_number+"_o").attr("class", "choice");*/
}


function validateempty(_elm) {
	if($("#"+_elm).attr("value")==null || $("#"+_elm).attr("value")=='') {
		$("#"+_elm).attr("class", "error");
	} else {
		$("#"+_elm).attr("class", "success");
	}
}

function validatepasswordrepeat(_elm, _elmb) {
	if($("#"+_elm).attr("value")!=$("#"+_elmb).attr("value") || $("#"+_elmb).attr("value")==null ) {
		$("#"+_elm).attr("class", "error");
	} else {
		$("#"+_elm).attr("class", "success");
	}
}



function validateemail(_elm) {

	$(document).ready(function() {
		r = $.ajax({
		  url: "index.php?cmd=7&laction=validateemail&email="+$("#"+_elm).attr("value"),
		  async: false
		}).responseText;

		if(r=="false") {
			$("#"+_elm).attr("class", "error");
		} else {
			$("#"+_elm).attr("class", "success");
		}
	});
}


function validatepassword(_elm, _text) {
	text = $("#"+_elm).attr("value");

	if(text==null) {
		text="";
	}

	$(document).ready(function() {
		r = $.ajax({
		  url: "index.php?cmd=7&laction=checkstrength&pass="+text,
		  async: false
		}).responseText;

	    var idx = 0;
	    if (r <  3) { idx = 0; }
	    if (r >= 3) { idx = 1; }
	    if (r >= 5) { idx = 2; }
	    if (r >= 6) { idx = 3; }
	    if (r >= 7) { idx = 4; }

	    var txt="",col="";
		switch(idx) {
			case 0: txt="5"; col="#ff0000"; break;
			case 1: txt="4"; col="#ff7e00"; break;
			case 2: txt="3"; col="#ffea00"; break;
			case 3: txt="2"; col="#3cb878"; break;
			case 4: txt="1"; col="#005825"; break;
		}

		$("#passsec").attr("color", col);
		$("#passsec").html(_text + "<b><span style='color: "+ col +"'>" + txt + "</span></b>");
	});
}


function checkwoher(_id) {
	if(_id=="5") {
		$('#commentbox').show();
	} else {
		$('#commentbox').hide();
	}
}