function $(idd)
{
	if(document.getElementById(idd)!=null)
	{
		return document.getElementById(idd);
	}
	else
	{
		return null;
	}
}

function rollover(obj, imsrc)
{
	obj.src=imsrc;
}

function clearDefaultValue(obj, defVal)
{
	if(obj.value==defVal)
	{
		obj.value='';
		obj.style.color='#000000';
	}
}

function restoreDefaultValue(obj, defVal)
{
	if(obj.value=='')
	{
		obj.value=defVal;
		obj.style.color='#cccccc';
	}
}

function selectPic(th, activeClass, activeId)
{
		active=document.getElementById(activeId);
		active.className="";
		active.id="";
		th.id=activeId;
		th.className=activeClass;
}
function openWindow(imgsrc, nameClass)
{
	mydiv=document.getElementById('imgLarge');
	mydivcont=document.getElementById('popupCont');

	im=new Image();
	im.src=imgsrc;
	wh=(window.innerHeight) ? window.innerHeight : document.documentElement.clientHeight;
	ww=(window.innerWidth) ? window.innerWidth : document.documentElement.clientWidth;
	mydiv.className=nameClass;
	mydiv.style.display="block";
	document.getElementById('popupCloseme').onclick=function(){document.getElementById('imgLarge').style.display='none';};
	mydivcont.innerHTML="<h1>LOADING...</h1>";
	window.setTimeout('im=new Image();im.src=\''+imgsrc+'\';document.getElementById("popupCont").innerHTML=\'<img src="'+im.src+'" alt="Click to close" title="Click to close" />\';', 10);
	//parseInt((ww-newDiv.offsetWidth)/2)  parseInt((wh-newDiv.offsetHeight)/2)
}

function selectActiveMenu(menuItem)
{
    var selMenuItem = document.getElementById("button1");
    if (menuItem)
        selMenuItem = document.getElementById(menuItem);

    selMenuItem.firstChild.className = "active" ;                        
}

// Use this function only in conditional expression just to check whether string is empty or not
function Trim(Untrimmed) 
{
	var Trimmed = ''
	for (var i = 0; i < Untrimmed.length; i++) 
	{
		if (Untrimmed.charCodeAt(i)!=32) 
			{
				Trimmed +=Untrimmed[i]
			}
	}
	return Trimmed
}
