function init ()
{
	externalLinks();
}
window.onload = init;

function changeClass(obj, new_class)
{
    obj.className = new_class;
}

function changeBgColor(obj, new_color)
{
	obj.style.backgroundColor=new_color;
}

function changePic(name, pic)
{
	name.src = pic;
}

function popup (url, name, width, height, scrollbars)
{
	left_pos = (screen.width / 2) - (width / 2);
	top_pos = (screen.height / 2) - (height / 2);

	window.open(url, name, 'resizable=1,scrollbars='+scrollbars+',status=no,toolbar=no,menubar=no,width=' + width + ',height=' + height + ',left=' + left_pos + ',top=' + top_pos);	
	return false;
}

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";
	}
}

function emptyfield (field, defaultval, blur)
{
	if ( blur == true ) {
		if (field.value == '') {
			field.value = defaultval;
		}
	} else {
		if (field.value == defaultval) {
			field.value = '';
		}
	}

	return true;
}

function checkFieldValue (id_name, dictionary_value)
{
	//alert(id_name+' : '+dictionary_value);
	if (dictionary_value == document.getElementById(id_name).value)
		document.getElementById(id_name).value = '';
}

function ajaxCall(url, params)
{
	xmlobj = null;	
	try
	{
		xmlobj=new XMLHttpRequest();
	}
	catch(e) {
		try
		{
			xmlobj=new ActiveXObject('Microsoft.XMLHTTP');
		}
		catch(e)
		{
			xmlobj=null;
			return false;
		}
	}
	xmlobj.open('POST', url, true);
	xmlobj.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	
	xmlobj.onreadystatechange = function() {
		if (xmlobj.readyState == 4) {
			xmlobj.status == 200;
			if (xmlobj.responseText) {
				document.getElementById('single-item').innerHTML = xmlobj.responseText;
				document.getElementById('multi-item').style.width = '48%';
				document.getElementById('single-item').style.visibility = 'visible';
			}
		}
	}
	xmlobj.send(params);
}



/**
 * Outsmarting the Google Toolbar
 * 
 * http://code.jenseng.com/google/
 */

  if(window.attachEvent)
    window.attachEvent("onload",setListeners);

  function setListeners(){
    inputList = document.getElementsByTagName("INPUT");
    for(i=0;i<inputList.length;i++){
      inputList[i].attachEvent("onpropertychange",restoreStyles);
      inputList[i].style.backgroundColor = "";
    }
    selectList = document.getElementsByTagName("SELECT");
    for(i=0;i<selectList.length;i++){
      selectList[i].attachEvent("onpropertychange",restoreStyles);
      selectList[i].style.backgroundColor = "";
    }
  }

  function restoreStyles(){
    if(event.srcElement.style.backgroundColor != "")
      event.srcElement.style.backgroundColor = "";
  }
