
function AddVenueToCompare(vid){
	updater_liveadminjs_loadURL('vtc.aspx?vtc='+vid, document.getElementById('venue_compare'))
}

function RemoveVenueFromCompare(vid){
	updater_liveadminjs_loadURL('vtc.aspx?vtr='+vid, document.getElementById('venue_compare'))
}



var lv_iframestate=0; //0=unloaded, 1=loading, 2=loaded
var lv_docwidth=updater_liveadminjs_getDocumentWidth(document)
var lv_reloadframe=true;

function updater_liveadminjs_totalElementXOffset(obj){
    var xOffset, elParent;
    if(typeof obj.offsetLeft != 'undefined'){
        xOffset = ((obj.offsetLeft)?obj.offsetLeft:0);
        elParent = obj.offsetParent;
        while(elParent){
            xOffset += ((elParent.offsetLeft)?elParent.offsetLeft:0);
            elParent = elParent.offsetParent;
        }
    }else if(typeof obj.x != 'undefined'){     xOffset = obj.x;
    }else{     
		xOffset = -1;
    } return xOffset;
}

function updater_liveadminjs_totalElementYOffset(obj){
    var yOffset, elParent;
    if(typeof obj.offsetTop != 'undefined'){
        yOffset = ((obj.offsetTop)?obj.offsetTop:0);
        elParent = obj.offsetParent;
        while(elParent){
            yOffset += ((elParent.offsetTop)?elParent.offsetTop:0);
            elParent = elParent.offsetParent;
        }
    }else if(typeof obj.y != 'undefined'){     yOffset = obj.y;
    }else{   
		yOffset = -1;
    } return yOffset;
}

function updater_liveadminjs_showframe(btt,srcx){
	
	iffx=document.getElementById? document.getElementById('updater_liveadmin_iframe'): document.all? document.all['updater_liveadmin_iframe']: null;
	iffxwin=window.frames['updater_liveadmin_iframe']
	if((lv_iframestate!=2||srcx!=iffx.src)&&srcx!=''){
		lv_iframestate=1
		iffx.src="#"
		iffx.style.height="30px";
		iffx.style.width="150px";
		iffx.style.border="1px solid black"
		iffx.src=srcx
		iffx.style.top=(updater_liveadminjs_totalElementYOffset(btt)+btt.offsetHeight)+"px"
		iffx.style.left=(updater_liveadminjs_totalElementXOffset(btt)+btt.offsetWidth)+"px"
	}else{
		lv_iframestate=0
		lv_target=""
		iffx.src=""
		iffx.style.height="1px"
		iffx.style.width="1px"
		iffx.style.top=0
		iffx.style.left=0
		iffx.style.border="0"
	}	

}
function updater_liveadminjs_getDocumentHeight(d) {
	var scrheight,offheight
	outval = 0;
	if (d.height) outval = d.height;
	else if (d.body) {
	 	if (d.body.offsetHeight) 
			outval = offheight = d.body.offsetHeight;
		if (d.body.scrollHeight) 
			outval = scrheight = d.body.scrollHeight;
		if (scrheight && offheight) 
			outval = Math.max(scrheight, offheight);
	}
	return outval;
}

function updater_liveadminjs_getDocumentWidth(d) {
	var scrwidth,offwidth
	outval = 0;
	if (d.width) outval = d.width;
	else if (d.body) {
	 	if (d.body.offsetWidth) 
			outval = offwidth = d.body.offsetWidth;
	 	if (d.body.scrollWidth) 
			outval = scrwidth = d.body.scrollWidth;
	 	if (scrwidth && offwidth) 
			outval = Math.max(scrwidth, offwidth);
	}
	return outval;
}

function updater_liveadminjs_reloadpage(){
	iffx=document.getElementById? document.getElementById('updater_liveadmin_iframe'): document.all? document.all['updater_liveadmin_iframe']: null;
	iffxwin=window.frames['updater_liveadmin_iframe']
	
	switch(lv_iframestate){
		case 0:
			break;
		case 1:
			nwidth=(iffx.style.width)
			if(nwidth.indexOf("px")>0)
				nwidth=nwidth.substring(0,nwidth.length-2)
			nleft=iffx.style.left.substring(0,iffx.style.left.length-2)
			if(parseInt(nleft)+parseInt(nwidth)>lv_docwidth)
				nleft=lv_docwidth-nwidth-25;
			iffx.style.left=nleft+"px"
			lv_iframestate=2;
			break;
		case 2:
			if(iffx.style.width=="0px"&&lv_reloadframe)
				window.location.reload();
			break;
	}

}

function updater_liveadminjs_resizeiframe(){
	resizeTo(document.body.scrollWidth+21,document.body.scrollHeight+50)
}

function updater_liveadminjs_hideiframe(){
	resizeTo(0,0)
}


function updater_liveadminjs_getHTTPObj(){
    var req = false;
    if(window.XMLHttpRequest) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
    }
    
    return req;
}

function updater_liveadminjs_postURL(url, targetdiv, postdata) {
	var req = updater_liveadminjs_getHTTPObj();
	if(req) {
		req.onreadystatechange = function(){
		        updater_liveadminjs_processdoc(req, targetdiv)
		    };
		if(url.indexOf("?")<0){
			url+="?"
		}else{
			url+="&";
		}
		url+="forcerefresh_zzzz="+escape(new Date())
		req.open("POST",url,true);
		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		req.send(postdata);
	}
}
function updater_liveadminjs_loadURL(url, targetdiv) {
	var req = updater_liveadminjs_getHTTPObj();
    // branch for native XMLHttpRequest object

	if(req) {
		req.onreadystatechange = function(){
		        updater_liveadminjs_processdoc(req, targetdiv)
		    };

		if(url.indexOf("?")<0){
			url+="?"
		}else{
			url+="&";
		}
		url+="forcerefresh_zzzz="+escape(new Date())
		req.open("GET", url, true);
		req.send("");
	}
}

function updater_liveadminjs_processdoc(req, targetdiv) {
    // only if req shows "loaded"
    if (req.readyState == 4) {
        // only if "OK"
        
        if (req.status == 200) {
			targetdiv.innerHTML=req.responseText		
			targetdiv.style.display = '';
			targetdiv.style.visibility = 'visible';
			var i=req.responseText.indexOf("alert(\'")
			if(i>0){
				e=req.responseText.indexOf("\')", i)
				var s=req.responseText.substring(i+"alert(\'".length, e);
				alert(s.replace(/\\n/g, "\n"));
			}

        } else {
			targetdiv.innerHTML="Error retreiving data" + req.responseText;
			targetdiv.style.display = '';
			targetdiv.style.visibility = 'visible';

        }
    }
}

function updater_liveadminjs_setSelectionDivVals(pk, display, displaydiv, tfield, selectionfield, selectiondiv, allowmultiple){
	field=document.forms[0][tfield];
	if(field.value.indexOf(pk)<0){
		if(field.value!=""&&allowmultiple)
			field.value+=",";
		else
			field.value="";
		field.value+=pk;
		displaydiv=document.getElementById(displaydiv);
		if(displaydiv.innerHTML!=""&&allowmultiple)
			displaydiv.innerHTML+=", ";
		else
			displaydiv.innerHTML="";
		displaydiv.innerHTML+=display;
		
		document.forms[0][selectionfield].value="";

		document.getElementById(selectiondiv).style.display = 'none';
		document.getElementById(selectiondiv).style.visibility = 'hidden';
	}
}

function updater_liveadminjs_showtooltip(obj, oPopup, text)
{
	if(oPopup.style.display !=''){
		oPopup.style.position="absolute";
		oPopup.style.top=(updater_liveadminjs_totalElementYOffset(obj)+10)+"px";
		oPopup.style.left=(updater_liveadminjs_mouseX+10)+"px";
		oPopup.innerHTML = text;
		oPopup.style.display = '';
		oPopup.style.visibility = 'visible';
   }
}

function updater_liveadminjs_hidetooltip(oPopup)
{
   oPopup.innerHTML = "";
   oPopup.style.display = 'none';
   oPopup.style.visibility = 'hidden';
}

var updater_liveadminjs_isIE = document.all;
var updater_liveadminjs_mouseX = 0;
var updater_liveadminjs_mouseY = 0;

function updater_liveadminjs_getMouseXY(e)
{
 if (!e) e = window.event;
 if (e)
 {
       updater_liveadminjs_mouseX = updater_liveadminjs_isIE ? (e.clientX + document.body.scrollLeft) : e.pageX;
       updater_liveadminjs_mouseY = updater_liveadminjs_isIE ? (e.clientY + document.body.scrollTop) : e.pageY;
 }
}

document.onmousemove = updater_liveadminjs_getMouseXY;