function centerElementHoriz(a,b,c){if(typeof c=="undefined"){c=0}YAHOO.util.Dom.setStyle(b,"position","relative");YAHOO.util.Dom.setStyle(b,"left",(js_get_elementWidth(a)/2)-(js_get_elementWidth(b)/2)+c+"px")}function browserSupportsAjax(){if(window.XMLHttpRequest){return true}else{if(window.ActiveXObject){request=new ActiveXObject("Msxml2.XMLHTTP");if(!request){request=new ActiveXObject("Microsoft.XMLHTTP");if(request){return true}}}}return false}function addURLParam(c,b,a){c+=(c.indexOf("?")==-1?"?":"&");c+=encodeURIComponent(b)+"="+encodeURIComponent(a);return c}function onPostFormSuccessCallback(a){return(function(b){a(b.responseText)})}function onPostFormFailureCallback(){return(function(a){FLYSWAT.widget.alertBox("Form submission error. Please try again "+a.statusText)})}function submitForm(c,f,a){try{YAHOO.util.Connect.setForm(c);var e=onPostFormSuccessCallback(a);var d=onPostFormFailureCallback();FLYSWAT.util.Connect.send(e,d,f,"","POST")}catch(b){alert(b+":submitForm")}}function onSubmitFormClick(b,c,a){return(function(f){try{if(f){YAHOO.util.Event.stopEvent(f)}submitForm(b,c,a)}catch(d){alert(d+"onSubmitFormClick")}})}function preg_match(c,a,b){regObj=new RegExpr(c);b=regObj.execute(a);return b.length}function js_get_screenCenterY(){return(window.outerHeight-js_get_scrollTop())/2}function getElementTop(a){yPos=a.offsetTop;tempEl=a.offsetParent;while(tempEl!=null){yPos+=tempEl.offsetTop;tempEl=tempEl.offsetParent}return yPos}function getElementLeft(a){xPos=a.offsetLeft;tempEl=a.offsetParent;while(tempEl!=null){xPos+=tempEl.offsetLeft;tempEl=tempEl.offsetParent}return xPos}function js_get_elementHeight(a){if(a.style.pixelHeight){xPos=a.style.pixelHeight}else{xPos=a.offsetHeight}return xPos}function js_get_elementWidth(a){if(a.style.pixelWidth){xPos=a.style.pixelWidth}else{xPos=a.offsetWidth}return xPos}function js_set_opacity(a,b){a.style.opacity=b/10;a.style.filter="alpha(opacity="+b*10+")"}function js_get_scrollTop(){if(self.pageYOffset){y=self.pageYOffset}else{if(document.documentElement&&document.documentElement.scrollTop){y=document.documentElement.scrollTop}else{if(document.body){y=document.body.scrollTop}}}return y}function js_get_scrollLeft(){if(self.pageYOffset){x=self.pageXOffset}else{if(document.documentElement&&document.documentElement.scrollTop){x=document.documentElement.scrollLeft}else{if(document.body){x=document.body.scrollLeft}}}return x}function moveToY(a,b){a.style.position="absolute";a.style.top=b}function moveToX(a,b){a.style.position="absolute";a.style.left=b}function moveHoriz(a,b){a.style.position="relative";a.style.left=b}function moveVert(a,b){a.style.position="relative";a.style.top=b}function getMousePos(b){var a=0;var c=0;if(!b){var b=window.event}if(b.pageX||b.pageY){a=b.pageX;c=b.pageY}else{if(b.clientX||b.clientY){a=b.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;c=b.clientY+document.body.scrollTop+document.documentElement.scrollTop}}return new Array(a,c)}function ajax(g,d,b,c,f){var e={success:g,failure:d};if(f.toUpperCase()=="GET"){b=b+"?"+c}var a=YAHOO.util.Connect.asyncRequest(f,b,e,c)}function print_r(obj,cont,tab){var propertyList="";var val="";for(prop in obj){eval("val = 'obj.' + prop");propertyList+=prop+"=&gt;"+eval(val);propertyList+="\n"}return propertyList}function toggleDisableItem(a){a.disabled=a.disabled?false:true}function nukeSelValues(a){a.options.length=0}function getTarget(b){var a;if(!b){var b=window.event}if(b.target){a=b.target}else{if(b.srcElement){a=b.srcElement}}if(a.nodeType==3){a=a.parentNode}return a}function initSelect(f,e,b,a){var d=0;var c=null;var g=null;for(d=0;d<b.length;d++){c=document.createElement("OPTION");c.setAttribute("value",b[d]);if(e==b[d]){c.setAttribute("selected",true)}g=document.createTextNode(a[d]);c.appendChild(g);f.appendChild(c)}}function highlightInputElement(a){a.style.border="2px solid #ff0000";a.focus()}function toCurrency(e){if(!e){return false}if(isNaN(e)){return false}e=""+Math.round(100*e);var c=e.length-2;var b=e.substring(0,c);var d=e.substring(c,e.length);var a=b+"."+d;return a}function removefromwatchlist(id,loggedIn,msgNotLoggedIn,msgRemoved){if(!loggedIn){FLYSWAT.widget.alertBox(msgNotLoggedIn)}else{var sURL="ajax-validation.php?run=watchlist-remove&id="+id;var json;var oRequest=new XMLHttpRequest();oRequest.open("get",sURL,true);oRequest.onreadystatechange=function(){if(oRequest.readyState==4){if(oRequest.status==200){json="json="+oRequest.responseText;json=eval(json);if(json[0].text=="yes"){FLYSWAT.widget.alertBox(msgRemoved);document.location.reload()}else{FLYSWAT.widget.alertBox("Error removing auction")}}}};oRequest.send(null)}}function addwatchlist(id,loggedIn,msgNotLoggedIn,msgAdded,msgInBuzzList){if(!loggedIn){FLYSWAT.widget.alertBox(msgNotLoggedIn)}else{var sURL="ajax-validation.php?run=watchlist-add&id="+id;var json;var oRequest=new XMLHttpRequest();oRequest.open("get",sURL,true);oRequest.onreadystatechange=function(){if(oRequest.readyState==4){if(oRequest.status==200){json="json="+oRequest.responseText;json=eval(json);if(json[0].text=="yes"){FLYSWAT.widget.alertBox(msgAdded)}else{FLYSWAT.widget.alertBox(msgInBuzzList)}}}};oRequest.send(null)}}function type(a){return a.constructor};

function centerElementVert(container, el, offset){
    if(typeof offset == "undefined"){
       offset = 0;
    }
    YAHOO.util.Dom.setStyle(el, 'position','relative');   
    YAHOO.util.Dom.setStyle(el, 'top', ((js_get_elementHeight(container)/2) - (js_get_elementHeight(el)/2) + offset)*-1 + 'px');
}

function js_get_screenCenterX(){
    var screenSize = getScreenSize();
    return(screenSize.width-js_get_scrollLeft())/2
}

function getScreenSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  return {width:myWidth, height:myHeight}
}
