
/// author: Matthew O'Riordan 
function openMail(email,src,cID) 
{ 
    if (!src) src = ''; 
 
    if (!cID) cID = '';
    window.open("/out.asp?url=" + email + "&amp;source=" + src + "&amp;com=" + cID, "email", 'scrollbars=0,toolbars=0,location=0,width=150,height=150,status=0,menubar=0,resizable=0'); 
	return (false);

 }

 function vote(val) 
 {
  document.location.href = "/poll/vote.asp?id=" + val; return (false);
 } 
 
 function goBack () { 
	history.go(-1); 
	return (false); 
 } 

 function openWindow(url, wname, w, h, maxv, stop_resize, stop_scroll)
 { 
	if (maxv) {
		var p = 'toolbars=0,location=0,status=0,menubar=0';
	} 
	else var p = 'toolbars=1,location=1,status=1,menubar=1';
	
	 p += ',resizable=' + (stop_resize ? '0' : '1') + ',scrollbars=' + (stop_scroll ? '0' : '1') + (w ? ',width=' + w : '') + (h ? ',height=' + h : ''); window.open (url, wname, p);
 } 
 
 function newsletterPopBehind()
  { 
	myWin=open('','newsletter_popup','toolbar=0,menubar=0,scrollbars=0,status=0,resizable=0,width=370,height=390'); 
	if (document.all)
	{
		try { myWin.blur(); myWin.location = '/other/newsletter_popup/'; 
		} catch (e) { true; }
  	} 
  	else { 
  	   myWin.blur(); myWin.location = '/other/newsletter_popup/';
	}
 }
 
  function gotoUrl(url,newWin)
   { 
     if (newWin) {
       window.open (url, "win" + (Math.floor(Math.random() * 1000)), '') 
     }
      else document.location.href = url; return (false); 
   }
  
   var b_ie = false; 
   b_netscape = false;
   b_opera = false;
   var agt=navigator.userAgent.toLowerCase(); 
   for (i = 3; i < 12; i++) 
   {
    if (agt.indexOf("opera " + i) != -1 || agt.indexOf("opera/" + i) != -1) 
    {
     b_opera = i; break;
    }
   }
   
   if (!b_opera && document.all)
   {
    if (document.getElementById) { b_ie = 5; }
     else
      { 
		b_ie = 4;
	  }
   }
   else if (document.getElementById)
   {
		if (window.find) { b_ns = 7 } 
		else { b_ns = 6 }
   }
   else if (document.layers) { b_ns = 4; } 
   
   var srchCh = new Object(); 

function calculateSearch () 
{ 
 var frm = document.forms['kbaseSearch']; 
 var frm2 = document.forms['kbaseVars'];
 if (!frm || !frm2) { return; }
 var cc = frm.elements['srch_cc']; 
 if (!cc) { 
 alert ('Content categories are missing from Kbase!'); 
 return; 
 }
 
  var oneCat = (!cc.length); 
  if (!srchCh['init'])
   {
    var splRx; 
	for (i = 0; i < (oneCat ? 1 : cc.length); i++)
	{
	  var ix = (oneCat ? cc.value : cc[i].value);
	  var stat = frm2.elements['search_stat_' + ix];
	  if (!stat) { 
		alert ('Kbase search data is missing!'); return;
	 }
	  statval = stat.value; 
	  srchCh[ix] = new Object();
	  if (statval) { 
	   matched = 0; matches = statval.split(','); 
	   
	  for (x = 0; x < matches.length; x++)
	  {
	   match = new RegExp("(\\d+):(\\d+)", "gi").exec (matches[x]);
	   if (match) 
	     matched = srchCh[ix][match[1]] = Number(match[2]); 
	  }
	  
	  if (!matched)
	   srchCh[ix] = Number(statval);
	}
  else srchCh[ix] = false; 
  stat.value = '';
  }
 
 srchCh['init'] = 1;

}
 var c = 0; 
 var year = frm.elements['srch_date']; 
 
 if (!year) {
  year = 99999 
 } else year = year.value; 
 
 if (isNaN(parseInt(year)) || year < 1)
  year = '99999'; 
  for (i = 0; i < (oneCat ? 1 : cc.length); i++)
   if (oneCat || cc[i].checked) 
   {
    var ref = srchCh[(oneCat ? cc.value : cc[i].value)]; 
    if (ref && ref[year])
    {
     c += ref[year];
    }
    else c += (!isNaN(parseInt(ref)) ? ref : 0); } c += '';
    
    for (i = 3; i < c.length; i += 4)
      c = c.substr (0, c.length - (i)) + "," + c.substring (c.length - i);
   
    var ref = (document.getElementById ? document.getElementById('srch_result_cnt') : (document.all ? document.all['srch_result_cnt'] : document.layers['srch_result_cnt']));
    
    if (ref) 
	{
	 ref.innerHTML = c;
	} else alert ('Result text area is missing');
	
 }
 
  var subnav = new Object();
  subnav.lastLayer = ''; 
  subnav.layerOpen = false; 

function showSubNav (layerID)
 {
  if ( (document.all) ) 
  {
    if ( (document.all['subnav_' + layerID]) && (document.all['subnav_' + layerID].style) )
     { 
		document.all['subnav_' + layerID].style.visibility = 'visible'; subnav.layerOpen = layerID;
    }
  }
}

 function mouseM() 
 {
   if (!document.all) return;
   var focus = event.srcElement;
   if (subnav.lastLayer != event.srcElement.sourceIndex) 
   {
    for (count = 0; count < 20; count++) 
     {
       if (focus.id == "subnav_container") break; 
       else if (focus.parentElement)
       {
        focus = focus.parentElement; 
       }
       else break;
     }
       if (focus.id != "subnav_container") 
       {
         if (subnav.layerOpen)
          {
            var count = 1;
             while ( (count < 10) )
             {
              if (document.all['subnav_' + count])
               document.all['subnav_' + count].style.visibility = 'hidden'; count++;
             } 
			subnav.layerOpen = false;
		 }
	  }
	} 
	
	subnav.lastLayer = event.srcElement.sourceIndex; 
 } // mouseM
 
  var navLoginVisible = false; 

function toggleLogin() {
 if (document.all) {
  if(document.all['navLoginDetailTarget'] && document.all['navLoginDetailSource'])
	  {
	    if (!navLoginVisible)
	    { 
			document.all['navLoginDetailTarget'].innerHTML = document.all['navLoginDetailSource'].innerHTML; 
			document.all['navLoginDetailSource'].innerHTML = ''; 
		} else { 
			document.all['navLoginDetailSource'].innerHTML = document.all['navLoginDetailTarget'].innerHTML; 
			document.all['navLoginDetailTarget'].innerHTML = '';
		 }
		 
		if (document.all['globalLoginIcon'] && document.all['globalLoginMinus']&& document.all['globalLoginPlus'])
		 { 
			document.all['globalLoginIcon'].src = (navLoginVisible ? document.all['globalLoginMinus'].src : document.all['globalLoginPlus'].src); 
		} 
		
			navLoginVisible = !navLoginVisible; return (false);
	 }
  } //document.all
  
}//function 

function getElem(elemId)
 {
  if (document.all) 
  {
   return (document.all[elemId]);
   } 
   else if (document.getElementById) 
  {
   return (document.getElementById (elemId));
  }
  else 
     return (false);
     
 }
  
  (imgPlus = new Image()).src = 'image/plus.gif';
  (imgMinus = new Image()).src = 'image/minus.gif'; 
  accountBoxOpen = false; 
  lastClick = new Date(); 

function accountBoxRoll (over)
 { 
	if (!accountBoxOpen) {
		tb = getElem('accountBoxTable');
		dt = getElem('accountBoxData');
			if (document.all) 
				tb.style.filter = dt.style.filter = (over ? "progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='black', Positive='true')" : '');
	}
} 

function accountPlusClick ()
 { 
    if ((new Date()).getTime() - lastClick.getTime() > 200)
	{ 
		lastClick = new Date(); 
		getElem('accountBoxData').style.visibility = (!accountBoxOpen ? 'visible' : 'hidden'); 
		getElem('accountBoxPlus').src = (!accountBoxOpen ? imgMinus : imgPlus).src;
		accountBoxOpen = !accountBoxOpen;
		
		if(getElem('accountBoxData').style.visibility == 'visible')
		{
		   if(parent.document.getElementById('MyLogin1:tbKullaniciAdi').value != '')
		   {
			if(parent.document.getElementById('MyLogin1:tbSifre') != null )
					parent.document.getElementById('MyLogin1:tbSifre').focus(); 
		   }
		   else
		   {
		    
		     parent.document.getElementById('MyLogin1:tbKullaniciAdi').focus(); 
		   }
	    }
	} 
	
	return (false);
} 
  
  document.onmousemove=mouseM;