var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}




function highon(obj)
{
obj.style.backgroundColor='#F5F5F5';
}
function highoff(obj)
{
obj.style.backgroundColor='';
}


function removebusiness()
{
if (confirm("If this business has been assigned to a reseller, you must first remove the reseller, then remove the business. proceed?")==true) 
{
	document.form1.action.value="delete";
	document.form1.submit()
}
}

function approve(val)
{
if (confirm("You are about to approve this advert and user to be placed on the site. proceed?")==true) 
{
	document.form1.id.value=val;
	document.form1.submit()
}
}

function checkforareas(area)
{
//alert(area);
if (area == '-') 
	{
		alert('Please choose an area first, then a town');
		return false;
	}
	else
		{
		return true;
		}
}

function MM_jumpMenu2(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
window.close()
}
function changeareas(area,obj)
{
if (area == '-') 
	{
		alert('Please choose a town, not an area');
	}
	else
		{
		MM_jumpMenu2('window.opener',obj,0)
		}
}

function removeprop()
{
if (confirm("You are about to remove your car from the site. proceed?")==true) 
{
	document.form1.submit()
}
}

function whatsthis()
{
alert("There are two types of users available for signup.\n\nIf you just wish to sell your car choose private seller.\n\nIf you are a company or individual who is going to be selling multiple cars then choose car dealer.\n\nThe cost for private sellers is for placing your motors on the site until sold. The car dealer price is for placing unlimited cars on the site for 12 months.");
}

function featuredwhatis()
{
alert("There are two types of ways of advertising your car on the site, standard and featured.\nFeatured adverts display a picture of your car next to your car details on search results, includes your car on the featured Motors list and even displays your car on the front page for a limited amount of time.\n\nIf you wish to pay extra and have your car included as a featured car, tick this box.");
}

function sethouse(val)
{
document.form1.hid.value=val
document.form1.submit()
}

function addproperty(val,name,email)
{
document.form1.id.value=val
document.form1.name.value=name
document.form1.email.value=email
document.form1.submit()
}

function topup(val)
{
document.form1.id.value=val
document.form1.submit()
}

function numbersonly() // this function only allows numbers
{
if (event.keyCode < 46 || event.keyCode > 57 || event.keyCode == 47) event.returnValue = false;
}

function removelisting(val)
{
if (confirm("You are about to remove this advert from the site. proceed?")==true) 
{
	document.form1.id.value=val;
	document.form1.submit()
}
}

function changeto(highlightcolor){
source=event.srcElement
if (source.tagName=="TR"||source.tagName=="TABLE")
return
while(source.tagName!="TR")
source=source.parentElement
if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore")
source.style.backgroundColor=highlightcolor
}

function changeback(originalcolor){
if (event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")
return;
if (event.toElement!=source)
source.style.backgroundColor=originalcolor;
}

function deleteuser()
{
if (confirm("Are you sure you wish to delete this user from your mailing list?")==true)
{	
	document.form1.action.value="delete";
	document.form1.submit();
}
}