



function swapImage(divId,swap){
	document.getElementById(divId).src=swap; 
}
function hoverBotMenu(divId,showHide){
	if (showHide == 1){
		document.getElementById(divId).style.backgroundImage="url('/images/bot_item_back.jpg')";
	}else{
		document.getElementById(divId).style.backgroundImage="none";
	}
}


function showHide(id){
	if (document.getElementById(id).style.display=='block'){
		document.getElementById(id).style.display='none';
	}else{
		document.getElementById(id).style.display='block';	
	}
}




function getValueById(inputId){
	if(document.getElementById(inputId)){ 
		inputType = document.getElementById(inputId).type;
		if (inputType == 'text'){
			inputValue = document.getElementById(inputId).value;
		}else if(inputType == 'select-one'){
			inputValue =document.getElementById(inputId)[document.getElementById(inputId).selectedIndex].value;
		}else if(inputType == 'hidden'){
			inputValue = document.getElementById(inputId).value;
		}
		return (inputValue);
	}else{
		return ('');
	}
}


function showHideShip(){
	shipValue = getValueById('shippingSelect');
	if (shipValue == 1){
		document.getElementById('aus_ship_opt').style.visibility='visible';
		document.getElementById('int_ship_opt').style.visibility='collapse';
		document.getElementById('ship_save').style.visibility='visible';
	}else if(shipValue == 2){
		document.getElementById('aus_ship_opt').style.visibility='collapse';
		document.getElementById('int_ship_opt').style.visibility='visible';
		document.getElementById('ship_save').style.visibility='visible';
	}else{
		document.getElementById('aus_ship_opt').style.visibility='collapse';
		document.getElementById('int_ship_opt').style.visibility='collapse';
		document.getElementById('ship_save').style.visibility='collapse';
	}
}

//Start Ajax Stuff...

var divName = ''//Declare global variable for div name

var fpws_http = fpws_getHTTPObject(); // We create the HTTP Object

function handleHttpResponse() {
	if (fpws_http.readyState == 4) {
    	results = fpws_http.responseText;
  		document.getElementById(divName).innerHTML = results;
	  }
}
function fpwsAjax(getUrl,passedDiv) {	
	var url = getUrl+'&z='+new Date().getTime();
	divName = passedDiv; //Update global vairable to div name we wrtie back to..
	fpws_http.open("GET", url, true);
	fpws_http.onreadystatechange = handleHttpResponse;	
	fpws_http.send(null);	
}

function fpwsAjaxTime(idName,getUrl,getValue,passedDiv) {	//Custom ajax created for module publish times...
	var moduleTime = '&hour='+document.getElementById(idName+'_hour_'+getValue).value
		+'&minute='+document.getElementById(idName+'_minute_'+getValue).value
		+'&year='+document.getElementById(idName+'_year_'+getValue).value
		+'&month='+document.getElementById(idName+'_month_'+getValue).value
		+'&day='+document.getElementById(idName+'_day_'+getValue).value;
 	var url = getUrl+getValue+moduleTime+'&z='+new Date().getTime();
	divName = passedDiv; //Update global vairable to div name we wrtie back to..
	/*var divName = 'ajaxDiv2';*/
	fpws_http.open("GET", url, true);
	fpws_http.onreadystatechange = handleHttpResponse;	
	fpws_http.send(null);	
}
function fpws_getHTTPObject() {
	fpwsHttpCon = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         fpwsHttpCon = new XMLHttpRequest();
         if (fpwsHttpCon.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            fpwsHttpCon.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            fpwsHttpCon = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               fpwsHttpCon = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!fpwsHttpCon) {
         alert('Unable to establish AJAX connection');
         return false;
      } else {
      	return fpwsHttpCon;
      }
}



