function buyBlock(blnr,bk1,bk2)
	{
		if(blnr==bk1)
		{alert("You have already bought this block");return false;}
		/*else if(blnr==bk2)
		{alert("You have already bought this block");return false;}*/
		else if(bk1!=0)
		{alert("You have already bought a block.\nPlease wait until it expires.");return false;}
		else
		{parent.location='buyblock.php?blval='+blnr+'&bl1='+bk1+'&bl2='+bk2;return false;}
	}

function chalert(getval,el) {
	if (confirm("Are you sure you want to change?")) {
       parent.location='myUZAP.php?myUZAP=1&ualval=' + getval;
    }
	else{
		document.form1.alerted[el].checked = false;
	}
	return false;
}

function popitup(url,size,type) {
	if(document.frmPost.adverTitle.value=="")
	{
		alert("Please enter a Listing Headline with descriptive Keywords.");
		document.frmPost.adverTitle.focus();
	}
	else
	{
		var dd = document.frmPost.sub_cat_id.selectedIndex;
		var subcat = document.frmPost.sub_cat_id[dd].text;
		var year ="";
		if(type==1)
		{
			year = document.frmPost.year.value;
		}
		
		url=url+"?headline="+URLEncode(document.frmPost.adverTitle.value)+"&subcat="+URLEncode(year+" "+subcat)+"&type="+type;
		
		newwindow=window.open(url,'name',size);
		if (window.focus) {newwindow.focus()}
	}
	return false;
}

function URLEncode (clearString) {
  var output = '';
  var x = 0;
  clearString = clearString.toString();
  var regex = /(^[a-zA-Z0-9_.]*)/;
  while (x < clearString.length) {
    var match = regex.exec(clearString.substr(x));
    if (match != null && match.length > 1 && match[1] != '') {
    	output += match[1];
      x += match[1].length;
    } else {
      if (clearString[x] == ' ')
        output += '+';
      else {
        var charCode = clearString.charCodeAt(x);
        var hexVal = charCode.toString(16);
        output += '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase();
      }
      x++;
    }
  }
  return output;
}


function careersShow(categ) {
var ss=document.frmCareer.usertype;
//alert(ss[0].value);
	if (ss[0].checked==true) {
       parent.location='showCareers.php?usr=employ&categ=' + categ;
    }
	else if (ss[1].checked==true){
		parent.location='showCareers.php?usr=seek&categ=' + categ;
	}
	return false;
}

function swapCountry(isoval) {
var ss=document.frmCountry.iso;
	ss.value=isoval;
	document.frmCountry.submit();
	return false;
}

function swapStateProvince(isoval,stateval) {
var ss=document.frmStateProvince.iso;
var ss1=document.frmStateProvince.state;

	ss.value=isoval;
	ss1.value=stateval;
	document.frmStateProvince.submit();
	return false;
}

function swapCity(cityval) {
var ss=document.frmCity.city;
	ss.value=cityval;
	document.frmCity.submit();
	return false;
}

function swapReal(realval) {
var ss=document.frmSubreal.forsaletype;
	ss.value=realval;
	document.frmSubreal.submit();
	return false;
}