function remimage($i2del){


var answer = confirm ("Are you sure you want to remove this image?") 
if (answer){
$remcommand="/place-ad/?doremimage='OK'+remimage="+escape($i2del);
window.location=$remcommand;
}


} 

function toggle_msg_box(){



document.getElementById('send_msg').style.display='block';

} 






function send_advertiser_msg(post_ID) {

	e=document.getElementById('msg_content').value;

	mydomain=window.location.hostname;
http.open("GET", 'http://'+mydomain+'/wp-content/themes/snapiweb_sandbox_blank/ajaxian/contact_advertiser.php?e='+escape(e)+'&p='+escape(post_ID),true); 

  http.onreadystatechange = handleHttpResponse_send_advertiser_msg;

  http.send(null);
 
  return false;

 }
 
 
 
 function handleHttpResponse_send_advertiser_msg() {

  if (http.readyState == 4) {


results = http.responseText;

document.getElementById('send_msg').innerHTML = results;




return false;
}
if (http.readyState != 4) {

}
} 
function handleHttpResponse_subcat() {

  if (http.readyState == 4) {


results = http.responseText;

document.getElementById('cat_options_results').innerHTML = results;
  return false; 
}

}
function show_sub_cat(post_ID) {
	var selObj = document.getElementById('top_cat');
	
	var selIndex = selObj.selectedIndex;
	
	event_type = selObj.options[selIndex].value;
	
	mydomain=window.location.hostname;
http.open("GET", 'http://'+mydomain+'/wp-content/themes/snapiweb_sandbox_blank/ajaxian/cat_details.php?e='+escape(event_type),true); 

  http.onreadystatechange = handleHttpResponse_subcat;

  http.send(null);
 
  return false;

 }
 function show_sub_cat_selected(cat_ID) {
	var selObj = document.getElementById('top_cat');
	
	var selIndex = selObj.selectedIndex;
	
	event_type = selObj.options[selIndex].value;
	
	mydomain=window.location.hostname;
http.open("GET", 'http://'+mydomain+'/wp-content/themes/snapiweb_sandbox_blank/ajaxian/cat_details.php?e='+escape(event_type)+'&c='+escape(cat_ID),true); 

  http.onreadystatechange = handleHttpResponse_subcat;

  http.send(null);
 
  return false;

 }
 
 function handleHttpResponse_cats() {

  if (http.readyState == 4) {

results = http.responseText;
document.getElementById('cat_specific_details').innerHTML = results;
  return false;
}

}
 
function show_specific2(post_ID) {
	var selObj = document.getElementById('cat');
	
	var selIndex = selObj.selectedIndex;
	
	event_type = selObj.options[selIndex].value;

	mydomain=window.location.hostname;
http.open("GET", 'http://'+mydomain+'/wp-content/themes/snapiweb_sandbox_blank/ajaxian/car_details.php?e='+escape(event_type)+'&p='+escape(post_ID),true); 

  http.onreadystatechange = handleHttpResponse_cats;

  http.send(null);
 
  return false;

 }
 
 



 function attraction_filter(event_type) {
	var selObj = document.getElementById('attraction_dropdown');
	var event_type = "Everything";
	
	var selIndex = selObj.selectedIndex;
	
	event_type = selObj.options[selIndex].text;
	
	selObj = document.getElementById('location_dropdown');
	event_location = "Everywhere";
	
	selIndex = selObj.selectedIndex;
	
	event_location = selObj.options[selIndex].text;
	


mydomain=window.location.hostname;
http.open("GET", 'http://'+mydomain+'/wp-content/themes/snapiweb_sandbox/ajax/attractions.php?e=' + escape(event_type) + '&l=' + escape(event_location), true); 

  http.onreadystatechange = handleHttpResponse_mates;

  http.send(null);
 
  return false;

 }
 
 
 
 function handleHttpResponse_image() {

  if (http.readyState == 4) {

document.getElementById('snap-msgs').innerHTML = '<img src=/images/spinner.gif align=absmiddle> Checking results...';


results = http.responseText;

document.getElementById('snap-msgs').innerHTML = results;
new Effect.Pulsate('snap-msgs',{ pulses: 1, duration: 2 });



return false;
}
if (http.readyState != 4) {
document.getElementById('snap-msgs').innerHTML = '<img src=/images/spinner.gif align=absmiddle> Snapping, One moment please...';
}
}
function snapit(snapID) {
document.getElementById('snap-msgs').innerHTML = '<img src=/images/spinner.gif align=absmiddle> Snapping, One moment please...';

mydomain=window.location.hostname;

http.open("GET", 'http://'+mydomain+'/play-snapit.php?snapID=' + escape(snapID), true); 

  http.onreadystatechange = handleHttpResponse_image;

  http.send(null);
 
  return false;

 }
 
 function handleHttpResponse_autosnap() {

  if (http.readyState == 4) {

document.getElementById('my-auto-snap'+snapID).innerHTML = '<img src=/images/spinner.gif align=absmiddle>';


results = http.responseText;

document.getElementById('my-auto-snap'+snapID).innerHTML = results;
new Effect.Pulsate('my-auto-snap'+snapID,{ pulses: 1, duration: 2 });



return false;
}
if (http.readyState != 4) {
document.getElementById('my-auto-snap'+snapID).innerHTML = '<img src=/images/spinner.gif align=absmiddle>';
}
}

//var snapID=78;
function auto_snap(snapIDx) {
snapID=snapIDx;
snap_value=document.getElementById('snap_value'+snapID).value;
document.getElementById('showautosnap'+snapID).innerHTML = '<img src=/images/spinner.gif align=absmiddle>Setting Autosnap';

mydomain=window.location.hostname;

http.open("GET", 'http://'+mydomain+'/auto-snapit.php?snapID=' + escape(snapID)+'&snap_value='+snap_value, true); 

  http.onreadystatechange = handleHttpResponse_autosnap;

  http.send(null);
 
  return false;

 }
 
 
 
 
 function getHTTPObject() {
    if (typeof XMLHttpRequest != 'undefined') {
        return new XMLHttpRequest();
    }
    try {
        return new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
        try {
            return new ActiveXObject("Microsoft.XMLHTTP");
        } catch (e) {}
    }
    return false;
}
var http = getHTTPObject(); // We create the HTTP Object



function update_ad_type(){
var found_it

for (var i=0; i<document.pfs_form.adtype.length; i++)  {
if (document.pfs_form.adtype[i].checked)  {

found_it = document.pfs_form.adtype[i].value

}

}

  
if (found_it=='Classified'){
document.getElementById('itsclassified').style.display='block';
document.getElementById('itsauction').style.display='none';
}else{
document.getElementById('itsclassified').style.display='none';
document.getElementById('itsauction').style.display='block';
}
   
  return false;

}

function check_me(){
  var found_it
  for (var i=0; i<document.pfs_form.adtype.length; i++)  {
	if (document.pfs_form.adtype[i].checked)  {
		found_it = document.pfs_form.adtype[i].value
	}
}
if (found_it=='Classified'){

}else{
 frmvalidator.addValidation("myprice","req","Please enter your starting price");
 frmvalidator.addValidation("reserveprice","req","Please enter a reserve price");
  frmvalidator.addValidation("buyitnowprice","req","Please enter a buy-it-now price");
}
frmvalidator.addValidation("pfs_title","req","You need to give your ad a title");
frmvalidator.addValidation("postcontent","req",	"Please add a description");
frmvalidator.addValidation("top_cat","dontselect=0",'Please select a category');
frmvalidator.addValidation("cat","dontselect=0",'Please select another category');
frmvalidator.addValidation("seller_email","maxlen=50");
frmvalidator.addValidation("seller_email","email");

}


 function handleHttpResponse_ad_type() {

  if (http.readyState == 4) {


results = http.responseText;

document.getElementById('ad_option_results').innerHTML = results;




return false;
}
if (http.readyState != 4) {

}
}

function GetCount(){

	dateNow = new Date();									//grab current date
	amount = dateFuture.getTime() - dateNow.getTime();		//calc milliseconds between dates
	delete dateNow;

	// time is already past
	if(amount < 0){
		document.getElementById('timer').innerHTML="<img src='/images/deal_over.png' style='padding-top:12px;'>";
	}
	// date is still good
	else{
		days=0;hours=0;mins=0;secs=0;out="";

		amount = Math.floor(amount/1000);//kill the "milliseconds" so just secs

		days=Math.floor(amount/86400);//days
		amount=amount%86400;
document.getElementById('days').innerHTML=days;
		hours=Math.floor(amount/3600);//hours
		amount=amount%3600;
document.getElementById('hours').innerHTML=hours;
		mins=Math.floor(amount/60);//minutes
		amount=amount%60;
document.getElementById('mins').innerHTML=mins;
		secs=Math.floor(amount);//seconds
document.getElementById('secs').innerHTML=secs;
		


		setTimeout("GetCount()", 1000);
	}
}

