function addLoadEvent(func)
{
	var oldonload = window.onload;
	if (typeof window.onload != 'function')
	{
		window.onload = func;
	}
	else
	{
		window.onload = function()
		{
			if (oldonload)
			{
				oldonload();
			}
			func();
		}
	}
}

function openImg(img)
{
	var X = screen.width / 2 - 250;
	var Y = screen.height / 2 - 250;
	myWin= open("", "displayWindow", "width=1,height=1,status=no,toolbar=no,menubar=no,resizable=no,left="+X+",top="+Y+"");
	myWin.document.open();
	myWin.document.write("<html><head><title></title></head>");
	myWin.document.write("<body topmargin=0 leftmargin=0>");
	myWin.document.write("<a href='javascript:close()'><center><img src="+img+" border=\"0\" name=\"fff\"></center></a>");
	myWin.document.write ("<script language=JavaScript>function resize(){ var xxx = document.fff.width; var yyy = document.fff.height+50; parent.window.resizeTo(xxx, yyy); setTimeout('resize()', 500);}; resize(); </script>")

	myWin.document.write("</body></html>");
	myWin.document.close();
}

function openWin( url, wd, ht)
{
   	var X = screen.width / 2 - wd/2;
	var Y = screen.height / 2 - ht/2;
    window.open( url , 'Print',"width="+wd+",height="+ht+",toolbar=no,menubar=yes,resizable=yes,scrollbars=yes,left="+X+",top="+Y+"");
}

function externalLinks()
{
	if (!document.getElementsByTagName) 
		return;

	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++)
	{
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")
			anchor.target = "_blank";
	}
}

addLoadEvent (externalLinks);

function xmlhttprequest ()
{
	this.url = null;
	this.requestmethod = "get";
	this.callback = null;
	this.getParams = new Array ();
	this.postdata = null;
	this.headers = new Array ();
	
	this.addGet = function (name, value)
	{
		this.getParams [this.getParams.length] = new Array (name, value);
	}
	
	this.addHeader = function (name, value)
	{
		this.headers [this.headers.length] = new Array (name, value);
	}
	
	this.send = function ()
	{
		if (window.XMLHttpRequest)
		{
			var ajax = new XMLHttpRequest();
		}
		else if (window.ActiveXObject)
		{
			var ajax = new ActiveXObject("Microsoft.XMLHTTP");
		}
		
		var _callback = this.callback;
		
		ajax.onreadystatechange = function ()
								{
									if (ajax.readyState == 4)
									{
										if (_callback != null) _callback (ajax.responseText);
										window.setTimeout ("ajax = null;", 10);
									}
								};
		
		for (i = 0; i != this.getParams.length; i++)
		{
			this.url += ((i == 0 ? "?" : "&") + this.getParams [i] [0] + (this.getParams [i] [1] == null ? "" : "=" + encodeURIComponent (this.getParams [i] [1])));
		}
		
		ajax.open (this.requestmethod.toLowerCase (), this.url, true);
		for (i = 0; i != this.headers.length; i++) 
			ajax.setRequestHeader (this.headers [i] [0], this.headers [i] [1]);

		if (this.requestmethod.toLowerCase () == "post") 
			ajax.setRequestHeader ("Content-Type", "multipart/form-data");

		ajax.send (this.postdata);
	}
}

function imgs()
{
    var images = document.getElementsByTagName('img');
    for (i=0; i<images.length; i++)
    {
        if (images[i].parentNode.parentNode.tagName != 'LI')
        {                                                          
          images[i].onmouseover = function() { this.style.borderColor = '#0483ae' };
          images[i].onmouseout = function() { this.style.borderColor = '#153453' };
        }
        else
        {
          images[i].onmouseover = function() { this.style.borderColor = '#042547' };
          images[i].onmouseout = function() { this.style.borderColor = '#35618F' };
        
        }
    }
}
addLoadEvent(imgs);

