var myloc = window.location.href;
var locarray = myloc.split("/");
locarray.splice(0,3);

function openawinder(URL,W,H){
	var winl = (screen.width - W) / 2;
	var wint = (screen.height - H) / 2;
	window.open(URL,"winNew",'top='+wint+',left='+winl+',true toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,height='+H+',width='+W);
}

function loadXDoc(XF,CBF){
   	var xdoc;
	if (window.XMLHttpRequest){ 
    	xdoc = new XMLHttpRequest();
	} else if (window.ActiveXObject){
    	xdoc = new ActiveXObject("Microsoft.XMLHTTP");
 	} 
	xdoc.onreadystatechange  = function(){ 
         if(xdoc.readyState  == 4){
             if(xdoc.status  == 200){
				CBF(xdoc.responseXML);
				return true;
             }else{
                 return false;
			}
         }
    }; 

   	xdoc.open('GET', XF,  true); 
   	xdoc.send(null);
}

function BuildArchives(xmlDoc){
	var hasInnerText =(document.getElementsByTagName("body")[0].innerText != undefined) ? true : false;
	var x = xmlDoc.getElementsByTagName('item');
	var data=document.createElement('UL');
	var f=document.getElementById('jcadata');
	f.innerHTML="";
	nsize=60;
	for (j=0; j<x.length; j++) {
		if(x[j]){
			cldnodes = x[j].childNodes;
			var LI = document.createElement('li');
			var L = document.createElement('A');
			for (h=0; h<cldnodes.length; h++) {
				if(cldnodes[h].tagName == 'title'){
					if(!hasInnerText){
						L.textContent=cldnodes[h].childNodes[0].nodeValue;
					}else{
						L.innerText=cldnodes[h].childNodes[0].nodeValue;
					}
					nsize=nsize+60;
					//f.style.height=nsize +"px";
				}else if(cldnodes[h].tagName == 'link'){
					L.href=cldnodes[h].childNodes[0].nodeValue;
				}
			}
			LI.appendChild(L);
			data.appendChild(LI);
		}
	}
	f.appendChild(data);
}
function charchivemen(A){
	btn=document.getElementById('jcabtn1');
	btnb=document.getElementById('jcabtn2');
	cntr=document.getElementById('jcatab1');
	document.getElementById('jcadata').innerHTML="<div align=\"center\"><img src=\"http://" + document.domain + "/" + locarray[0] + "/images/ajax-loader.gif\" width=\"32\" height=\"32\" alt=\"\" border=\"0\" style=\"margin:30px\"/></div>";
	if(A == 0){
		btn.style.backgroundImage="url('http://" + document.domain + "/" + locarray[0] + "/images/ArchMenu_Tran1.gif')";
		btn.style.backgroundRepeat="no-repeat";
		btn.style.backgroundPosition="top right";
		cntr.style.backgroundColor="#b2b2b2";
	}else{
		btn.style.backgroundImage="url('http://" + document.domain + "/" + locarray[0] + "/images/ArchMenu_Tran2.gif')";
		btn.style.backgroundRepeat="no-repeat";
		btn.style.backgroundPosition="top right";
		cntr.style.backgroundColor="#e5e5e5";
	}
}
function getStyle(obj, styleProp){
  	if (obj.currentStyle)
    	return obj.currentStyle[styleProp];
  	else if (window.getComputedStyle)
    	return document.defaultView.getComputedStyle(obj,null).getPropertyValue(styleProp);
}
window.onload = function(){
	if(document.getElementById('jcadata')){
		loadXDoc("http://" + document.domain + "/tasks/feed/?feedID=CC937029-F052-53E6-0F85A99445CA340C",BuildArchives);
	}
}
function searchbf(){
	f=document.getElementById('searchForm');
	if(f.keywords.value == 'SEARCH'){
		f.keywords.value="";
	}
}