	
	function GetContentWnd(){ return parent; }
	
	function OnSave(){
		var oWnd = GetContentWnd();
		url = oWnd.location.href;
		title = oWnd.document.title;
		if (window.sidebar) { // Mozilla Firefox Bookmark
			window.sidebar.addPanel(title, url,"");
		} else if( window.external ) { // IE Favorite
			window.external.AddFavorite( url, title); }
		else if(window.opera && window.print) { // Opera Hotlist
			return true; 
		}
		//window.external.addFavorite( oWnd.location.href, oWnd.document.title );
		return true;
	}
	
	function checkemail(emailadd){
		patern = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;///^([\w\-\.\+])+@+(([\w])+.+([.\w])+)$/; 
		if(!emailadd.value.match(patern)){
			alert("Địa chỉ email không hợp lệ!");
			emailadd.focus();
			return false;
		}
		return true;
	}
	
	String.prototype.trim = function () {
	    return this.replace(/^\s*/, "").replace(/\s*$/, "");
	}
	
	function checkpostjs(){
		e = document.frmquest.elements;
		len = e.length;
		for(i=0; i<len; i++){
			if(e[i].value.trim() == '' && e[i].id != 'picref'){
				alert("Vui lòng cung cấp đầy đủ thông tin quy định của 1 tin rao!");
				e[i].focus();
				return false;
			}
		}
		spcval = document.getElementById('cntclsfiel');
		quest = spcval.value;
		quest = quest.trim();
		if(quest.length < 25 || quest.length > 700 ){
			alert("Nội dung tin rao tối thiểu 25 ký tự & tối đa 500 kí tự!");
			spcval.focus();
			return false;
		}
		return true;
	}
