// JavaScript Document
function doSubmit(theForm,theElement,origAction){
	var theValue = theForm.elements[theElement].value;
	(theValue == "99")? theForm.action = "placeanad2.php" : theForm.action = origAction;
	theForm.submit();
}
function doPreview(){
	//var photo1 = document.step4.photo1.value;
	//document.step4.photopath1.value = photo1;
	window.open('','CallMePopUp','status=no,width=975,height=850,scrollbars=yes');
	document.step4.target ='CallMePopUp';
	document.step4.action = "placeanadpreview.php";
	document.step4.submit();
	document.step4.target ='';
	document.step4.action = "placeanad5.php";
}
function doPreview4(){
	//var photo1 = document.step4.photo1.value;
	//document.step4.photopath1.value = photo1;
	window.open('','CallMePopUp','status=no,width=975,height=850,scrollbars=yes');
	document.step4.target ='CallMePopUp';
	document.step4.action = "placeanadpreview.php";
	document.step4.submit();
}
function doSubmit4(){
	//var photo1 = document.step4.photo1.value;
	//document.step4.photopath1.value = photo1;
	document.step4.target ='';
	document.step4.action = "edit_ad_txt.php";
	document.step4.submit();
}
function doSubmitEdit(){
	//var photo1 = document.step4.photo1.value;
	//document.step4.photopath1.value = photo1;
	document.editlisting.target ='';
	document.editlisting.action = "edit_ad_txt.php";
	document.editlisting.submit();
}

function doAction4(act,listingid,photoid,photoname){
	//var photo1 = document.step4.photo1.value;
	//document.step4.photopath1.value = photo1;
	//window.open('','CallMePopUp','status=0,width=975,height=850,scrollbars=yes,location=1');
	document.step4.target ='';
	document.step4.action = "edit_photos_action.php?act="+act+"&listingid="+listingid+"&photoid="+photoid+"&photoname="+photoname;
	document.step4.submit();
}
function radio_button_checker(){
	var radio_choice = false;
	for (counter = 0; counter < document.step2.ad_pack.length; counter++)
		{
		if (document.step2.ad_pack[counter].checked) radio_choice = true; 
		}
		if (!radio_choice)
		{
			alert("Please select a Package")
			return (false);
		}
	return (true);
}

function movepic(img_src) {
document['mainpic'].src=img_src;
}

var cal4 = new CalendarPopup();
	var now = new Date();
	cal4.showYearNavigation();
	cal4.setWeekStartDay(1);
	
<!-- Copyright 2006,2007 Bontrager Connection, LLC
// http://bontragerconnection.com/ and http://www.willmaster.com/
// Version: July 28, 2007
var cX = 0; var cY = 0; var rX = 0; var rY = 0;
function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}
function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}
if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
else { document.onmousemove = UpdateCursorPosition; }
function AssignPosition(d) {
if(self.pageYOffset) {
	rX = self.pageXOffset;
	rY = self.pageYOffset;
	}
else if(document.documentElement && document.documentElement.scrollTop) {
	rX = document.documentElement.scrollLeft;
	rY = document.documentElement.scrollTop;
	}
else if(document.body) {
	rX = document.body.scrollLeft;
	rY = document.body.scrollTop;
	}
if(document.all) {
	cX += rX; 
	cY += rY;
	}
d.style.left = (cX+10) + "px";
d.style.top = (cY+10) + "px";
}
function HideContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
if(d.length < 1) { return; }
var dd = document.getElementById(d);
AssignPosition(dd);
dd.style.display = "block";
}
function ReverseContentDisplay(d) {
if(d.length < 1) { return; }
var dd = document.getElementById(d);
AssignPosition(dd);
if(dd.style.display == "none") { dd.style.display = "block"; }
else { dd.style.display = "none"; }
}


function initOverLabels () {
  if (!document.getElementById) return;  	

  var labels, id, field;

  // Set focus and blur handlers to hide and show 
  // LABELs with 'overlabel' class names.
  labels = document.getElementsByTagName('label');
  for (var i = 0; i < labels.length; i++) {
	
    if (labels[i].className == 'overlabel') {

      // Skip labels that do not have a named association
      // with another field.
      id = labels[i].htmlFor || labels[i].getAttribute('for');
      if (!id || !(field = document.getElementById(id))) {
        continue;
      }

      // Change the applied class to hover the label 
      // over the form field.
      labels[i].className = 'overlabel-apply';

      // Hide any fields having an initial value.
      if (field.value !== '') {
        hideLabel(field.getAttribute('id'), true);
      }

      // Set handlers to show and hide labels.
      field.onfocus = function () {
        hideLabel(this.getAttribute('id'), true);
      };
      field.onblur = function () {
        if (this.value === '') {
          hideLabel(this.getAttribute('id'), false);
        }
      };

      // Handle clicks to LABEL elements (for Safari).
      labels[i].onclick = function () {
        var id, field;
        id = this.getAttribute('for');
        if (id && (field = document.getElementById(id))) {
          field.focus();
        }
      };

    }
  }
}

function hideLabel (field_id, hide) {
  var field_for;
  var labels = document.getElementsByTagName('label');
  for (var i = 0; i < labels.length; i++) {
    field_for = labels[i].htmlFor || labels[i].getAttribute('for');
    if (field_for == field_id) {
      labels[i].style.textIndent = (hide) ? '-1000px' : '0px';
      return true;
    }
  }
}

function openWindow(page,width,height) {
newWindow=window.open(page,'newWindow2','width='+width+',height='+height+',left=80,top=50,resizable=1,scrollbars=1');
newWindow.resizeTo(width,height);
newWindow.focus();
}

//-->
