var xmlHttp

function showModel(str)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="getmodel.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("txtHint").innerHTML=xmlHttp.responseText 
 } 
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}


function Language_Type(lang)
{
	document.forms[0].Language_Types.value = lang;
	document.forms[0].action = window.location.href;
	document.forms[0].submit();
}

function popupWindowURL(url, winname,  w, h, menu, resize, scroll, x, y) {
	
	if (winname == null) winname = "newWindow";
	if (w == null) w = 600;
	if (h == null) h = 600;
	if (resize == null) resize = 1;
	
	menutype   = "nomenubar";
	resizetype = "noresizable";
	scrolltype = "noscrollbars";
	if (menu) menutype = "menubar";
	if (resize) resizetype = "resizable";
	if (scroll) scrolltype = "scrollbars";
	
	if (x == null || y == null) {
		cwin=window.open(url,winname,"status," + menutype + "," + scrolltype + "," + resizetype + ",width=" + w + ",height=" + h);
	}
	else {
		cwin=window.open(url,winname,"top=" + y + ",left=" + x + ",screenX=" + x + ",screenY=" + y + "," + "status," + menutype + "," + scrolltype + "," + resizetype + ",width=" + w + ",height=" + h);
	}
	if (!cwin.opener) cwin.opener=self;
	cwin.focus();
	
	return true;
}



function setHomePage (url) {
  if (document.all && document.getElementById)
    oHomePage.setHomePage(url);
  else if (document.layers && navigator.javaEnabled()) {
    netscape.security.PrivilegeManager.enablePrivilege
('UniversalPreferencesWrite');
    navigator.preference('browser.startup.homepage', url);
  }
}

function Check_Click(selectall)
{
	if(document.all["recent_search_id[]"].length)
	{
		if(selectall == 'yes')
		{
			for(i=0; i < document.all["recent_search_id[]"].length; i++)
			{
				document.all["recent_search_id[]"][i].checked = true;
			}
		}
		else
		{
			for(i=0; i < document.all["recent_search_id[]"].length; i++)
			{
				document.all["recent_search_id[]"][i].checked = false;
			}
		}
	}
	else
	{
		if(document.frmMember.checkall.checked == true)
		{
			document.all["selectall[]"].checked = true;
		}
		else
		{
			document.all["selectall[]"].checked = false;
		}
	}
}


function UploadImage_Change(obj, imgTag, defaultVal, defaultWidth)
{
	imgTag.width=120;
	if(obj.value == '')
		imgTag.src = defaultVal;
	else
	{
		imgTag.src = obj.value;
		if(defaultWidth != '')
			imgTag.width=defaultWidth;
	}
}

function CheckUncheck_Click(fld, status)
{
	
	if(fld.length)
		for(i=0; i < fld.length; i++)
			fld[i].checked = status;
	else
		fld.checked = status;
}

function Validate_Login_Form(frm)
{
	with(frm)
	{
		if(!IsEmpty(username, 'Please enter username.'))
		{
			return false;
		}
		if(!IsEmpty(passwd, 'Please enter Password.'))
		{
			return false;
		}
		action.value = 'Login';
        submit();
		return true;
	}
}
