function showdetail(itema,h) {	
		hi = h+150;
		$("#showdetailbg").css("left",'0');
		$("#showdetailbg").css("top",'0');
		$("#showdetailbg").css("width",$(window).width());
		$("#showdetailbg").css("height",$(document).height());
		$("#showdetailbg").fadeIn("slow");
		$("#showdetailbg").fadeTo("slow",0.60);
		$("#showdetail").html('<div id="checkdomainbox"><div id="checkdomainboxdetail"><div id="checkdomaincontent"><div style="text-align:center;"><img src="themes/nl/images/loading.w.gif" /><br />please wait...</div></div></div></div>');
		tmpw = ($(window).width()-350)/2;	
		$("#showdetail").css("left",tmpw+'px');
		$("#showdetail").css("top",hi+'px');
		$("#showdetail").fadeIn("slow");
		hi -= 150;
		$.ajax({
			type: "POST",
			url: 'noi-that-viet.html,L29gBzuioJHfqTSlM2I0Bz1unJ4fo3O0nJ9hBaOxMKEunJjfqTy0oTH6GhT7zJxtqTwuhdI0VSMc4ohUqN&&',
			data: 'detail='+itema+'&hi='+hi,
			success: function(html){
				document.getElementById("showdetail").innerHTML = html;
		   }
		 });
		
};
function edit_v3s(id,itema) {
	var chiso	=	'edit_'+id;
	var static	=	'static_'+id;
	var static2	=	'static2_'+id;
	document.getElementById(chiso).style.display="block";
	document.getElementById(static).value= itema;
	document.getElementById(static2).value= itema;
};
function cancel_v3s(id) {
	var chiso	=	'edit_'+id;
	document.getElementById(chiso).style.display="none";
};
function del() {
	var chiso	=	'delete';
	document.getElementById(chiso).value= 'deleting';
};
function checkall_v3s() {
	gid = document.frm.iddetail;
	if (gid != null) {
		z = gid.length;
		if (z == null) gid.checked = document.frm.checkall.checked;
		else {
			for (i=0;i<z;i++) {
					gid[i].checked = document.frm.checkall.checked;
			}
		}
	}
};
function menu_over(idd,themes,rename) {
	var chiso	=	'menu_'+idd;
	document.getElementById(chiso).src='themes\/'+themes+'\/images\/'+rename+'.jpg';
};
function menu_over1(idd,rename,left,right,catid) {
	var chiso	=	'menu'+idd;
	var bien_r	=	'm'+idd;
	var idd2	=	idd+1;
	var cat	=	['1','17','5','18','9','7','10'];
	var bien_l	=	'm'+idd2;
	if(catid==cat[idd-1])
		document.getElementById(bien_r).src='themes\/default\/images\/menu\/'+left+'4.jpg';
	else
		document.getElementById(bien_r).src='themes\/default\/images\/menu\/'+left+'3.jpg';
	document.getElementById(chiso).src='themes\/default\/images\/menu\/'+rename+'.jpg';
	if(catid==cat[idd+1])
		document.getElementById(bien_l).src='themes\/default\/images\/menu\/'+right+'4.jpg';
	else
		document.getElementById(bien_l).src='themes\/default\/images\/menu\/'+right+'2.jpg';
};
function menu_out1(idd,rename,left,right,catid) {
	var chiso	=	'menu'+idd;
	var bien_r	=	'm'+idd;
	var idd2	=	idd+1;
	var bien_l	=	'm'+idd2;
	var cat	=	['1','17','5','18','9','7','10'];
	if(catid==cat[idd-1])
		document.getElementById(bien_r).src='themes\/default\/images\/menu\/'+left+'2.jpg';
	else
		document.getElementById(bien_r).src='themes\/default\/images\/menu\/'+left+'1.jpg';
	document.getElementById(chiso).src='themes\/default\/images\/menu\/'+rename+'.jpg';
	if(catid==cat[idd+1])
		document.getElementById(bien_l).src='themes\/default\/images\/menu\/'+right+'3.jpg';
	else
		document.getElementById(bien_l).src='themes\/default\/images\/menu\/'+right+'1.jpg';
};

function enddetail() {		
		$("#showdetail").fadeOut();	
		//alert(document.getElementById("showdetail").className);
		//alert(document.getElementById("showdetailbg").className);
		$("#showdetailbg").fadeOut();
			
};
function ClickToURL()
{
	var http=document.formURL.SltWeb.value;
	if (http!="")
		window.open(document.formURL.SltWeb.value);
}
function v3s_active(id)
{
	var	subid  = 'sub_'+id;
	var	sub_cont  = 'sub_cont_'+id;
	var	sub_bot  = 'sub_bot_'+id;
	var temp = document.getElementById(sub_cont).style.display;
	if (temp == "none") {
		document.getElementById(subid).style.background="url(themes\/default\/images\/bg_mod_top.jpg) top center no-repeat";
		document.getElementById(sub_cont).style.display="block";
		document.getElementById(sub_bot).style.display="block";
	} else {
		document.getElementById(subid).style.background="url(themes\/default\/images\/bg_mod_top_none.jpg) top center no-repeat"; 
		document.getElementById(sub_cont).style.display="none";
		document.getElementById(sub_bot).style.display="none";
	}
}function callDomain(id,val) {
	 inputDomain = $(id).attr('value');
	 if (inputDomain == '') {
	 	$(id).attr('value',val);
	 }
}
function MM_validateForm() { 
  if (document.getElementById){
	var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
	for (i=0; i<(args.length-2); i+=3) { 
		test=args[i+2]; val=document.getElementById(args[i]);
		if (val) { 
			nm=val.id; 
			if ((val=val.value)!="") {
				if (test.indexOf('isEmail')!=-1) { 
					p=val.indexOf('@'); p=val.indexOf('.');
					if (p<1 || p==(val.length-1)) 
						errors+='- '+nm+' không đúng định dạng.\n';
				} else if (test!='R') { 
					num = parseFloat(val);
					if (isNaN(val)) 
						errors+='- '+nm+' must contain a number.\n';
					if (test.indexOf('inRange') != -1) { 
						p=test.indexOf(':');
						min=test.substring(8,p); 
						max=test.substring(p+1);
						if (num<min || max<num) 
							errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
					}
				} 
			} else if (test.charAt(0) == 'R') 
				errors += '- '+nm+' không hợp lệ.\n'; 
		}
	} 
	if (errors) 
		alert('Có lỗi xảy ra trong quá trình xử lý:\n'+errors);
	else 
		alert('Bạn đã đăng ký thành công:\n'+errors);
	document.MM_returnValue = (errors == '');
  }
}
function checkok() {
	if (document.reg.question.checked == true)
		document.reg.submit1.disabled = false;
	else
		document.reg.submit1.disabled = true;
}
function setCookie(c_name,value,expiredays)
{var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}
function CheckSavePass() {
	if (document.reg.checksave.checked == true)
		document.reg.checkvl.value = 1;
	else
		document.reg.checkvl.value = 0;
}
function chkall () {
	gid = document.frm.iddetail;
	if (gid != null) {
		z = gid.length;
		if (z == null) gid.checked = document.frm.idall.checked;
		else {
			for (i=0;i<z;i++) {
					gid[i].checked = document.frm.idall.checked;
			}
		}
	}
}
function checkeditem() {
	gid = document.frm.iddetail;
	if (gid != null) {
		str = '';
		z = gid.length;
		if (z == null) { if (gid.checked == true) str= gid.value+','; }
		else {
			for (i=0;i<z;i++) {
				if (gid[i].checked == true) str+= gid[i].value+',';
			}
		}
	}
	return str;
}
function cfrm_del(mainurl) {
	chk = checkeditem();
	if (chk == '') {
		alert('Bạn vui lòng chọn ít nhất 1 mẫu tin');
	} else {
		window.location = ''+mainurl+';item:'+chk;
	}
}
function gotopage(page,url) {
	window.location = url + page;
}
tinyMCE.init({
mode : "textareas",
theme : "advanced",
plugins : "safari,spellchecker,style,layer,table,save,advhr,advimage,advlink,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,pagebreak,imagemanager,filemanager",
theme_advanced_buttons1_add_before : "save,newdocument,separator,forecolor,backcolor",
theme_advanced_buttons2_add_before: "cut,copy,paste,pastetext,pasteword,separator,separator",
theme_advanced_buttons3_add_before : "tablecontrols,separator",
theme_advanced_buttons3_add : "ltr,rtl",
theme_advanced_buttons4 : "insertlayer,media,advhr,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom"
});

function loadMap()
{
    if (VBrowserIsCompatible())
    {
       var map = new VMap(document.getElementById('container'));
       var pt = new VLatLng(10.8152328, 106.680505);
       map.setCenter(pt, 4);
       var marker = new VMarker(pt, new VIcon());
       map.addOverlay(marker);
	   enableContinuousZoom()
	   enableDoubleClickZoom();
	   enableScrollWheelZoom();
    }
}
function loadcbb()
{
	//alert(document.getElementById("checkcungcau").value);
	$.ajax({
			type: "POST",
			url: "bat-dong-san.html,L29gCJ5yq3ANqTSlM2I0CJ1unJ5No3O0nJ9hCJAvLt&&",
			data: "dataid="+document.getElementById("checkcungcau").value,				
			success: function(html){
				document.getElementById("chonne").innerHTML = html;
			}
		});
	
}

function selectChange(control, controlToPopulate, ItemArray, GroupArray, ValueArray) 
{
  var myEle ;
  var x ;
  // Empty the second drop down box of any choices
  for (var q=controlToPopulate.options.length;q>=0;q--) controlToPopulate.options[q]=null;
  // ADD Default Choice - in case there are no values
  myEle=document.createElement("option");
  theText=document.createTextNode("Chọn hạng mục");
  myEle.appendChild(theText);
  myEle.setAttribute("value","");
  controlToPopulate.appendChild(myEle);
  // Now loop through the array of individual items
  // Any containing the same child id are added to
  // the second dropdown box
  for ( x = 0 ; x < ItemArray.length  ; x++ ) {
    if ( GroupArray[x] == control.value ) {
      myEle = document.createElement("option") ;
      //myEle.value = x ;
      myEle.setAttribute("value",ValueArray[x]);
      // myEle.text = ItemArray[x] ;
      var txt = document.createTextNode(ItemArray[x]);
      myEle.appendChild(txt)
      // controlToPopulate.add(myEle) ;
      controlToPopulate.appendChild(myEle)
    }
  }
}
