//boundary defaults
var boundaryX = 550;
var boundaryY = 630;

var mapXOffset = 0;
var mapYOffset = 0;

function detailClick(jur,type,id,txt) {
	var id = jur+"_"+type+"_"+id; 
        if(type=="CAM")
		camPop(id.toLowerCase());
	else if(type=="CMS")
		cmsPop(id.toLowerCase());
        else if(type=="CNST") {
            overlib(txt, CLOSECLICK,PIN,CLOSETEXT,"<img border=\"0\" src=\"images/close.gif\" />", STICKY,DRAG,CAPTION, 'Construction');
        } else if(type=="INC") {
            overlib(txt, CLOSECLICK,PIN,CLOSETEXT,"<img border=\"0\" src=\"images/close.gif\" />", STICKY,DRAG,CAPTION, 'Incident');
        }
}

function camPop(id,cursorX,cursorY) {
	var jti = id.split("_");
        var Address = "popUp?jur=" + jti[0] + "&type=" + jti[1] + "&id=" + jti[2] + "&large=";
        overlib("<div align='center'><img src='images/cameras/small_" + id + ".jpg' ondblclick=\"window.open('" + Address + "','popWindow','addressbar=no,statusbar=no,scrollbars=no,menubar=no,width=650,height=540');\" /></div>", CLOSECLICK,PIN,CLOSETEXT,"<img border=\"0\" src=\"images/close.gif\" />", STICKY,DRAG, CAPTION, 'Traffic Cam');

}

function cmsPop(id,cursorX,cursorY) {
	overlib("<div align='center'><img src='images/signs/" + id + ".gif' /></div>", STICKY,DRAG,PIN, CLOSECLICK,CLOSETEXT,"<img border=\"0\" src=\"images/close.gif\" />", CAPTION, 'Sign');
}

function detailOut(){
	//don't do this unless there is no sticky
	if(o3_showingsticky==0) {
		nd();
	}
}
function detailOver(jur,type,id,txt,txt2){
	//don't do this unless there is no sticky
	if(o3_showingsticky==0) {
		var caption = txt2;
		var content = txt;
		switch (type) {
			case 'CAM':
			  caption = 'Traffic Cam';
			  break;
			case 'CMS':
			  caption = 'Message Sign';
			  break;
			case 'INC':
			  break;
                        case 'RCL':
			  break;
			case 'CNST':
			  caption = 'Construction';
			  break;
			case 'STN':
			  caption = 'Detection Station';
			  break;
			case 'WMS':
			  caption = 'Weather Station';
			  break;
			default:
			  return;
		}

		content = content + '<div class="overlib_id">' + 
			jur + '-' + type + '-' + id + '</div>';
		overlib(content, CAPTION, caption);
	}
}

function zoomOutOver(name){ 
        if(o3_showingsticky==0) {
            overlib('Click to zoom out to the ' + name + ' map.',
		CAPTION, 'Zoom Out');
        }
}
function zoomOutOut(){nd();}

function zoomInOver(name,left,top,width,height){
	show_zoom(left,top,width,height,name);
}

function zoomInOut(){
	hide_zoom();
	//nd();
}

function panOver(name){
	if(o3_showingsticky==0) {
            overlib('Click to pan over to the ' + name + ' map.',
                            CAPTION, 'Pan');
       }


}
function panOut(){
    if(o3_showingsticky==0) {
        nd();
    }
}

function show_zoom(left,top,width,height,name) {
    
  //add the offsets
  left += mapXOffset;
  top  += mapYOffset;

  var lt = document.getElementById('mapzm_lt');
  lt.style.left   = left+'px';
  lt.style.top    = top+'px';
  lt.style.width  = '2px';
  lt.style.height = height+'px';

  var rt = document.getElementById('mapzm_rt');
  rt.style.left   = (left+width)+'px';
  rt.style.top    = top+'px';
  rt.style.width  = '2px';
  rt.style.height = height+'px';

  var tp = document.getElementById('mapzm_tp');
  tp.style.left   = left+'px';
  tp.style.top    = top+'px';
  tp.style.width  = width+'px';
  tp.style.height = '2px';

  var bt = document.getElementById('mapzm_bt');
  bt.style.left   = left+'px';
  bt.style.top    = (top+height)+'px';
  bt.style.width  = (2+width)+'px';
  bt.style.height = '2px';

  lt.className    = 'mapzm_show';
  rt.className    = 'mapzm_show';
  tp.className    = 'mapzm_show';
  bt.className    = 'mapzm_show';

  self.status     = 'Zoom In';
}
function hide_zoom() {
  var lt = document.getElementById('mapzm_lt');
  var rt = document.getElementById('mapzm_rt');
  var tp = document.getElementById('mapzm_tp');
  var bt = document.getElementById('mapzm_bt');

  lt.className = 'mapzm_hide';
  rt.className = 'mapzm_hide';
  tp.className = 'mapzm_hide';
  bt.className = 'mapzm_hide';

  lt.style.left   = '1px';
  lt.style.top    = '1px';
  lt.style.width  = '0px';
  lt.style.height = '0px';

  rt.style.left   = '1px';
  rt.style.top    = '1px';
  rt.style.width  = '0px';
  rt.style.height = '0px';

  tp.style.left   = '1px';
  tp.style.top    = '1px';
  tp.style.width  = '0px';
  tp.style.height = '0px';

  bt.style.left   = '1px';
  bt.style.top    = '1px';
  bt.style.width  = '0px';
  bt.style.height = '0px';

  self.status = '';
}
