
function openIU(inVal){              
   window.open('../includes/imgUploder.php?htmlElement='+inVal,'ImageBrowser','width=550,height=160');
}

function calMonthPrice(){
	var propertyPricePW 	= document.getElementById("propertyPricePW");
	var propertyPricePM 	= document.getElementById("propertyPricePM");
	var calculatedVal		= (parseFloat( (propertyPricePW.value * 52) / 12 )).toFixed(2);
	propertyPricePM.value	= calculatedVal;
}
function isValidMail(mailStr) {
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if(filter.test(mailStr))
		return true;	
	else
		return false;
} 
function isIntVal(inVal){
	if(isNotNull(inVal)){
		myRe=/\d*/;
		arr = myRe.exec(inVal);
		if (arr[0] != inVal){
			return false;
		}
		else{
			return true;
		}
	}	
	else{
		return false;
	}
}
function isNotNull(inVal){
	regx=/\s*/;
	inVal=inVal.replace(regx,'');	
	if(inVal.length > 0)
		return true
	else
		return false;
}

function deleteRecord(inLink){
	if(confirm("Are you sure you want to delete this record?")){
		document.location.href=inLink;
	}
}
function changePaging(inVal){
	pageingVal = document.getElementById("pageing").value;
	if(pageingVal > 0 ){
		document.location.href=inVal+'p='+pageingVal;
	}
 }
function openIB(inVal){              
   window.open('../includes/imgBrowser.php?htmlElement='+inVal,'ImageBrowser','width=550,height=460');
}
function addImg(inVal)
{
	var currentImgPath = document.getElementById("currentImgPath").value;
	if(currentImgPath.length > 0){
		var wyaImageInput =  window.opener.document.getElementById(inVal).value;
		window.opener.document.getElementById(inVal).value = currentImgPath;
		window.close();
	}
}
function addImgRtf()
{
	var currentImgPath = document.getElementById("currentImgPath").value;
	if(currentImgPath.length > 0){
		var imgHtml = '<img _moz_resizing="true" src="'+currentImgPath+'" /> ';
		window.opener.tinyMCE.activeEditor.selection.setContent(imgHtml);
		window.close();
	}
}
function isNumberKey(evt)
{
 var charCode = (evt.which) ? evt.which : evt.keyCode
 if (charCode > 31 && (charCode < 48 || charCode > 57)){
	if (charCode == 46)
		return true;
	return false;	
 }
 return true;
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function hiddenAllDiv(){
	var theDivs = document.getElementsByTagName('div')
	for (var i = 0; i < theDivs.length; i++){
  		if ( (theDivs[i].id.indexOf('wyaLayer') == 0) || (theDivs[i].id.indexOf('bpSpeLayer')==0) ){
			theDivs[i].style.visibility ="hidden";
  		}
	}
}
function MM_showHideLayers() { //v6.0  
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  hiddenAllDiv();
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function openCalender(inVal,inVal1){
	window.open('../../includes/calendar.php?formID='+inVal+'&elementID='+inVal1,'Calendar','width=200,height=200');
}
function testAllFormElement(){
	
	if(confirm("Total Form are :"+document.forms.length+"\n\n Do you want to continue?")){
		for(var x = 0 ; x < document.forms.length;x++){
			var currentFrm = document.forms[x];
			for(var y = 0; y < currentFrm.length; y++){
				var frmElmt = currentFrm[y];
				alert("[Form: "+ currentFrm.name +"] [ID: "+frmElmt.id+"] [Value:"+frmElmt.value+"]");
			}
		}
		return false;
	}
}
