function refreshMap(fipVar)
{
toggleBox('mapdata',0);

var Icmap = document.getElementById("icscMap");
Icmap.style.width= "574px";
Icmap.style.height= "255px";
}

function loadXmlHttp(url, id) {
 var f = this;
 if (loadXmlHttp.xmlHttp){
  f.xmlHttp = loadXmlHttp.xmlHttp();
  f.el = document.getElementById(id);
  f.xmlHttp.open("GET", url, true);
  f.xmlHttp.onreadystatechange = function(){f.stateChanged();};
  f.xmlHttp.send(null);
 }
 else alert('Your browser does not support AJAX!'); // substitute your desired request object unsupported code here
}

loadXmlHttp.xmlHttp = null; loadXmlHttp.re = /^http/.test(window.location.href);
/*@cc_on @*/ // used here and below, limits try/catch to those IE browsers that both benefit from and support it
/*@if(@_jscript_version >= 5) // prevents errors in old browsers that barf on try/catch & problems in IE if Active X disabled
try {loadXmlHttp.ie = window.ActiveXObject}catch(e){};
@end @*/
if (window.XMLHttpRequest && (!loadXmlHttp.ie || loadXmlHttp.re))
 loadXmlHttp.xmlHttp = function(){return new XMLHttpRequest();}; // Firefox, Opera 8.0+, Safari, others, IE 7+ when live - this is the standard method
else if (/(object)|(function)/.test(typeof createRequest))
 loadXmlHttp.xmlHttp = createRequest; // ICEBrowser, perhaps others
else {
 loadXmlHttp.xmlHttp = null;
// Internet Explorer 5 to 6, includes IE 7+ when local //
/*@if(@_jscript_version >= 5)
try{loadXmlHttp.xmlHttp = function(){return new ActiveXObject("Msxml2.XMLHTTP");};}
 catch(e){try{loadXmlHttp.xmlHttp = function(){return new ActiveXObject("Microsoft.XMLHTTP");};}catch(e){}}
@end @*/
}

loadXmlHttp.prototype.stateChanged = function(){
 if (this.xmlHttp.readyState == 4 && (this.xmlHttp.status == 200 || !loadXmlHttp.re))
  this.el.innerHTML = this.xmlHttp.responseText;
	if (document.URL.indexOf('/map/',1)!=-1) {ScrollToControl('mapdataFull');}
}

function elementPosition(obj) {
var curleft = 0, curtop = 0;

if (obj.offsetParent) {
curleft = obj.offsetLeft;
curtop = obj.offsetTop;

while (obj = obj.offsetParent) {
curleft += obj.offsetLeft;
curtop += obj.offsetTop;
}
}

return { x: curleft, y: curtop };
}

function ScrollToControl(id)
{
var elem = document.getElementById(id);
var scrollPos = elementPosition(elem).y;
scrollPos = scrollPos - document.documentElement.scrollTop;
var remainder = scrollPos % 50;
var repeatTimes = (scrollPos - remainder) / 50;
ScrollSmoothly(scrollPos,repeatTimes);
window.scrollBy(0,remainder);
}
var repeatCount = 0;
var cTimeout;
var timeoutIntervals = new Array();

var timeoutIntervalSpeed;
function ScrollSmoothly(scrollPos,repeatTimes)
{
if(repeatCount < repeatTimes)
{
window.scrollBy(0,30);
}
else
{
repeatCount = 0;
clearTimeout(cTimeout);
return;
}
repeatCount++;
cTimeout = setTimeout("ScrollSmoothly('" + scrollPos + "','"+ repeatTimes +"')",100);
}

function getWinSize(){
var iWidth = 0, iHeight = 0;

if (document.documentElement && document.documentElement.clientHeight){
iWidth = parseInt(window.innerWidth,10);
iHeight = parseInt(window.innerHeight,10);
}
else if (document.body){

iWidth = parseInt(document.body.offsetWidth,10);
iHeight = parseInt(document.body.offsetHeight,10);
}

return {width:iWidth, height:iHeight};
}


function toggleBox(szDivID, iState) 
{
   var obj = document.layers ? document.layers[szDivID] : document.getElementById ?  document.getElementById(szDivID).style : document.all[szDivID].style;
   obj.visibility = document.layers ? (iState ? "show" : "hide") : (iState ? "visible" : "hidden");
}

function getData(countryid,qtype) 
{

var oIllus = document.getElementById("mapdata");
var oWinSize = getWinSize();

if (document.documentElement && document.documentElement.clientHeight){
	var n=(oWinSize.width/2)-98;
	var h=(oWinSize.height/2)-300;
}
else if (document.body){
	var n=(oWinSize.width/2)-100;
	var h=(oWinSize.height/2)-300;
}

oIllus.innerHTML="<br><br><br><br><br><br><center><img src='/images/ajaxload.gif'><br><br><font size='1' color='#ffffff'><b>LOADING</b></font></center>";
oIllus.style.left=n.toString()+"px";
oIllus.style.top="159px"; //h.toString()+"px";
oIllus.style.width= "574px";
oIllus.style.height= "307px";
oIllus.style.padding="0px";
oIllus.style.border="0px solid #08083A";
oIllus.style.backgroundColor="#08083A";
oIllus.style.display="block";
new loadXmlHttp('/resources/mapdata/getdata.asp?rpt='+qtype+ '&id='+countryid+'&d='+Date(), 'mapdata');

var Icmap = document.getElementById("icscMap");
Icmap.style.width= "0px";
Icmap.style.height= "0px";

toggleBox('mapdata',1);
}

function getFullData(countryid,qtype) 
{

var oIllus = document.getElementById("mapdataFull");

oIllus.innerHTML="";
oIllus.style.padding="0px";
oIllus.style.border="0px solid #08083A";
new loadXmlHttp('/resources/mapdata/getdataFull.asp?rpt='+qtype+ '&id='+countryid+'&d='+Date(), 'mapdataFull');
//alert ('/resources/mapdata/getdataFull.asp?rpt='+qtype+ '&id='+countryid+'&d='+Date());

}

function closeFullData() 
{

var oIllus = document.getElementById("mapdataFull");
oIllus.innerHTML="<b>Map Disclaimer</b><br>The boundaries, shapes and names shown and the designations used on this map do not imply official endorsement or acceptance by the United Nations.<br><br><b>How to Use</b><br>To view data for a single location, click on it to zoom in then click on the <img src='/images/unlogo_legend.gif'> icon to display the data.  Alternatively, you may use the first drop down to select and zoom in to a location.<br><br>You may also view data for three (3) seperate locations at the same time by selecting the location name on the drop down lists right below the map then clicking on [ Compare ].<br><br>Data is seperated into three sections (Post Adjustment, Daily Subsistence Allowance and Hardship Classification). Simply click on the links to swap between each section.<br><br>";
}


function getCompare(country1,country2,country3,qtype) 
{

var oIllus = document.getElementById("mapdataFull");
var oMapFull = document.getElementById("icscMap");

oIllus.innerHTML="";
oIllus.style.padding="0px";
oIllus.style.border="0px solid #08083A";
new loadXmlHttp('/resources/mapdata/getdataFull.asp?rpt='+qtype+ '&id='+country1+'&country2='+country2+'&country3='+country3+'&d='+Date(), 'mapdataFull');
//alert ('/resources/mapdata/getdataFull.asp?rpt='+qtype+ '&id='+country1+'&country2='+country2+'&country3='+country3+'&d='+Date());

}

function showMsg(icscMessage) 
{
toggleBox('mapdata',0);

var oIllus = document.getElementById("mapdata");
var oWinSize = getWinSize();

var n=(oWinSize.width/2)-90;
var h=(oWinSize.height/2)-300;

oIllus.innerHTML="";
oIllus.style.left=n.toString()+"px";
oIllus.style.top="413px"; //h.toString()+"px";
oIllus.style.width= "560px";
oIllus.style.height= "50px";
oIllus.style.padding="0px";
oIllus.style.border="0px solid #08083A";
oIllus.style.backgroundColor="#08083A";
oIllus.style.display="block";
new loadXmlHttp('/includes/showMsg.asp?msgid=' + icscMessage, 'mapdata');

toggleBox('mapdata',1);
}

// MAP ZOOM STUFF

        function zoomTo(_state) {
            var flashObj = swfobject.getObjectById("icscMap");
            if (flashObj) {
              flashObj.zoomTo(_state);
            }
        }
        
        function zoomPoint(_point) {
            var flashObj = swfobject.getObjectById("icscMap");
            if (flashObj) {
              flashObj.zoomPoint(_point);
            }
        }

        function refreshData(_data) {
            var flashObj = swfobject.getObjectById("icscMap");
            if (flashObj) {
              flashObj.refreshData(_data);
            }
        }

function countryZM(dropstate) {
	if (dropstate.length > 2) {
		zoomPoint(dropstate);
	} else {
		zoomTo(dropstate);
	}
}





// end map stuff

/* <![CDATA[ */var qm_si,qm_li,qm_lo,qm_tt,qm_th,qm_ts,qm_la,qm_ic,qm_ib;var qp="parentNode";var qc="className";var qm_t=navigator.userAgent;var qm_o=qm_t.indexOf("Opera")+1;var qm_s=qm_t.indexOf("afari")+1;var qm_s2=qm_s&&qm_t.indexOf("ersion/2")+1;var qm_s3=qm_s&&qm_t.indexOf("ersion/3")+1;var qm_n=qm_t.indexOf("Netscape")+1;var qm_v=parseFloat(navigator.vendorSub);;function qm_create(sd,v,ts,th,oc,rl,sh,fl,ft,aux,l){var w="onmouseover";var ww=w;var e="onclick";if(oc){if(oc=="all"||(oc=="lev2"&&l>=2)){w=e;ts=0;}if(oc=="all"||oc=="main"){ww=e;th=0;}}if(!l){l=1;qm_th=th;sd=document.getElementById("qm"+sd);if(window.qm_pure)sd=qm_pure(sd);sd[w]=function(e){qm_kille(e)};document[ww]=qm_bo;if(oc=="main"){qm_ib=true;sd[e]=function(event){qm_ic=true;qm_oo(new Object(),qm_la,1);qm_kille(event)};document.onmouseover=function(){qm_la=null;clearTimeout(qm_tt);qm_tt=null;};}sd.style.zoom=1;if(sh)x2("qmsh",sd,1);if(!v)sd.ch=1;}else  if(sh)sd.ch=1;if(oc)sd.oc=oc;if(sh)sd.sh=1;if(fl)sd.fl=1;if(ft)sd.ft=1;if(rl)sd.rl=1;sd.style.zIndex=l+""+1;var lsp;var sp=sd.childNodes;for(var i=0;i<sp.length;i++){var b=sp[i];if(b.tagName=="A"){lsp=b;b[w]=qm_oo;if(w==e)b.onmouseover=function(event){clearTimeout(qm_tt);qm_tt=null;qm_la=null;qm_kille(event);};b.qmts=ts;if(l==1&&v){b.style.styleFloat="none";b.style.cssFloat="none";}}else  if(b.tagName=="DIV"){if(window.showHelp&&!window.XMLHttpRequest)sp[i].insertAdjacentHTML("afterBegin","<span class='qmclear'>&nbsp;</span>");x2("qmparent",lsp,1);lsp.cdiv=b;b.idiv=lsp;if(qm_n&&qm_v<8&&!b.style.width)b.style.width=b.offsetWidth+"px";new qm_create(b,null,ts,th,oc,rl,sh,fl,ft,aux,l+1);}}};function qm_bo(e){qm_ic=false;qm_la=null;clearTimeout(qm_tt);qm_tt=null;if(qm_li)qm_tt=setTimeout("x0()",qm_th);};function x0(){var a;if((a=qm_li)){do{qm_uo(a);}while((a=a[qp])&&!qm_a(a))}qm_li=null;};function qm_a(a){if(a[qc].indexOf("qmmc")+1)return 1;};function qm_uo(a,go){if(!go&&a.qmtree)return;if(window.qmad&&qmad.bhide)eval(qmad.bhide);a.style.visibility="";x2("qmactive",a.idiv);};;function qa(a,b){return String.fromCharCode(a.charCodeAt(0)-(b-(parseInt(b/2)*2)));};function qm_oo(e,o,nt){if(!o)o=this;if(qm_la==o&&!nt)return;if(window.qmv_a&&!nt)qmv_a(o);if(window.qmwait){qm_kille(e);return;}clearTimeout(qm_tt);qm_tt=null;qm_la=o;if(!nt&&o.qmts){qm_si=o;qm_tt=setTimeout("qm_oo(new Object(),qm_si,1)",o.qmts);return;}var a=o;if(a[qp].isrun){qm_kille(e);return;}if(qm_ib&&!qm_ic)return;var go=true;while((a=a[qp])&&!qm_a(a)){if(a==qm_li)go=false;}if(qm_li&&go){a=o;if((!a.cdiv)||(a.cdiv&&a.cdiv!=qm_li))qm_uo(qm_li);a=qm_li;while((a=a[qp])&&!qm_a(a)){if(a!=o[qp]&&a!=o.cdiv)qm_uo(a);else break;}}var b=o;var c=o.cdiv;if(b.cdiv){var aw=b.offsetWidth;var ah=b.offsetHeight;var ax=b.offsetLeft;var ay=b.offsetTop;if(c[qp].ch){aw=0;if(c.fl)ax=0;}else {if(c.ft)ay=0;if(c.rl){ax=ax-c.offsetWidth;aw=0;}ah=0;}if(qm_o){ax-=b[qp].clientLeft;ay-=b[qp].clientTop;}if(qm_s2&&!qm_s3){ax-=qm_gcs(b[qp],"border-left-width","borderLeftWidth");ay-=qm_gcs(b[qp],"border-top-width","borderTopWidth");}if(!c.ismove){c.style.left=(ax+aw)+"px";c.style.top=(ay+ah)+"px";}x2("qmactive",o,1);if(window.qmad&&qmad.bvis)eval(qmad.bvis);c.style.visibility="inherit";qm_li=c;}else  if(!qm_a(b[qp]))qm_li=b[qp];else qm_li=null;qm_kille(e);};function qm_gcs(obj,sname,jname){var v;if(document.defaultView&&document.defaultView.getComputedStyle)v=document.defaultView.getComputedStyle(obj,null).getPropertyValue(sname);else  if(obj.currentStyle)v=obj.currentStyle[jname];if(v&&!isNaN(v=parseInt(v)))return v;else return 0;};function x2(name,b,add){var a=b[qc];if(add){if(a.indexOf(name)==-1)b[qc]+=(a?' ':'')+name;}else {b[qc]=a.replace(" "+name,"");b[qc]=b[qc].replace(name,"");}};function qm_kille(e){if(!e)e=event;e.cancelBubble=true;if(e.stopPropagation&&!(qm_s&&e.type=="click"))e.stopPropagation();};function qm_pure(sd){if(sd.tagName=="UL"){var nd=document.createElement("DIV");nd.qmpure=1;var c;if(c=sd.style.cssText)nd.style.cssText=c;qm_convert(sd,nd);var csp=document.createElement("SPAN");csp.className="qmclear";csp.innerHTML="&nbsp;";nd.appendChild(csp);sd=sd[qp].replaceChild(nd,sd);sd=nd;}return sd;};function qm_convert(a,bm,l){if(!l)bm[qc]=a[qc];bm.id=a.id;var ch=a.childNodes;for(var i=0;i<ch.length;i++){if(ch[i].tagName=="LI"){var sh=ch[i].childNodes;for(var j=0;j<sh.length;j++){if(sh[j]&&(sh[j].tagName=="A"||sh[j].tagName=="SPAN"))bm.appendChild(ch[i].removeChild(sh[j]));if(sh[j]&&sh[j].tagName=="UL"){var na=document.createElement("DIV");var c;if(c=sh[j].style.cssText)na.style.cssText=c;if(c=sh[j].className)na.className=c;na=bm.appendChild(na);new qm_convert(sh[j],na,1)}}}}}/* ]]> */

