function open_w(URL,info,w,h)
{
www=window.open(URL,info,'width='+w+',height='+h+',top=120,left=245,toolbar=no,personalbar=no,location=no,directories=no,statusbar=no,menubar=no,status=no,resizable=yes');
}

function copyText(theSel) {
if(navigator.userAgent.indexOf('MSIE') != -1)
{
	document.execCommand('copy',false,theSel.value);
}
else
{
   theForm = theSel.form;
   theForm.copyArea.value=theSel.options[theSel.selectedIndex].value;
	alert(theForm.copyArea.value);
   r=theForm.copyArea.createTextRange();
   r.select();
   r.execCommand('copy');
}
}

function validEmail(email)
{
var invalidChars=" /;:"
var atPos,badChar

if(email=="")
  return false;

for(i=0;i<invalidChars.length;i++)
 {
  badChar=invalidChars.charAt(i)

  if(email.indexOf(badChar,0)>-1)
    return false;
 }

atPos= email.indexOf("@",1)

if(atPos==-1)
  return false;

if(email.indexOf("@",atPos+1)!=-1)
  return false;

periodPos=email.indexOf(".",atPos)

if(periodPos==-1)
  return false;

if(periodPos+3>email.length)
  return false;

return true;
}

function CheckIt(f)
{
var email=f.email.value
var pword=f.pword.value
var fname=f.fname.value
var lname=f.lname.value
var reminder=f.pwordreminder.value
var terms = f.read_terms.checked;
if(fname.length == 0)
{
        alert('Enter your first name');
        return false;
}

if(lname.length == 0)
{
	alert('Enter your last name');
	return false;
}

if(!validEmail(email))
 {
  alert('Enter valid E-mail!')
  f.email.focus()
  return false;
 }
else if(pword=="")
 {
  alert('Enter your password!')
  f.pword.focus()
  return false;
 }

if(reminder.length == 0)
{
        alert('Please enter a password reminder');
        return false;
}

if(!terms)
{
	alert("You must agree to the terms of use before creating an account");
	return false;
}

return true;


}

function sendAweber(email)
{
	/*
	 try {
                            netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
                           } catch (e) {
                            alert("Permission UniversalBrowserRead denied.");
                           }
	*/
                        AjaxRequest.post(
                        {
                                'url':'http://www.aweber.com/scripts/addlead.pl',
                                'parameters':{
                                                'meta_web_form_id':'1658740382',
                                                'meta_split_id':'',
                                                'unit':'carseller',
                                                'redirect':'http://www.carsalesiq.com/login.php?activate_account=true',
                                                'meta_redirect_onlist':'http://www.carsalesiq.com/',
                                                'meta_adtracking':'',
                                                'meta_message':'1',
                                                'meta_required':'from',
                                                'meta_forward_vars':'0',
                                                'from':email,
                                                'submit':'Submit'
                                         }
                                //'onSuccess':function(req){ alert(req.responseText); },
                                //'onError':function(req){ alert(\"Error! StatusText=\"+req.statusText+\" Contents=\"+req.responseText); }

                        });

}


