// JavaScript Document
function changeMenu(id,mid){
	//alert(id);
	//alert(mid);
	if(document.getElementById("Menu"+mid)){
		document.getElementById("Menu"+mid).src="img/"+id+"_o.gif";
		if(document.getElementById("Sep"+(mid-1)))
			document.getElementById("Sep"+(mid-1)).src="img/trans.gif";
		if(document.getElementById("Sep"+mid))
			document.getElementById("Sep"+mid).src="img/trans.gif";
	}	
}
function resetMenu(id,mid){
	if(document.getElementById("Menu"+mid)){
		document.getElementById("Menu"+mid).src="img/"+id+".gif";
		if(document.getElementById("Sep"+(mid-1)))
			document.getElementById("Sep"+(mid-1)).src="img/m_sep.gif";
		if(document.getElementById("Sep"+mid))
			document.getElementById("Sep"+mid).src="img/m_sep.gif";
	}
}
function resetMenuprev(id,mid){
	if(document.getElementById("Menu"+mid)){
		document.getElementById("Menu"+mid).src="img/"+id+".gif";
		if(document.getElementById("Sep"+(mid-1)))
			document.getElementById("Sep"+(mid-1)).src="img/m_sep.gif";
		if(document.getElementById("Sep"+mid))
			document.getElementById("Sep"+mid).src="img/trans.gif";
	}
}
function resetMenunext(id,mid){
	if(document.getElementById("Menu"+mid)){
		document.getElementById("Menu"+mid).src="img/"+id+".gif";
		if(document.getElementById("Sep"+(mid-1)))
			document.getElementById("Sep"+(mid-1)).src="img/trans.gif";
		if(document.getElementById("Sep"+mid))
			document.getElementById("Sep"+mid).src="img/m_sep.gif";
	}
}


var preVal="";
function expandContentBold(id)
{  	
	if(preVal!="" && preVal!=id)
	{
		//document.getElementById("bullet_"+preVal).src="img/info_on.gif";
		//document.getElementById("a"+preVal).className="normal";
		//document.getElementById("w"+preVal).className="text_hidden";
		document.getElementById(id).className="text_hidden";
		preVal="";
	}
	val=((document.getElementById(id).className)=="text_hidden")? true:false;

	if(val)
	{
		//document.getElementById("bullet_"+id).src="img/info_off.gif";
		//document.getElementById("a"+id).className="hand";
		//document.getElementById("w"+id).className="text_visible";
		document.getElementById(id).className="text_visible";
	}
	else
	{
		//document.getElementById("bullet_"+id).src="img/info_on.gif";
		//document.getElementById("a"+preVal).className="normal";
		//document.getElementById("w"+id).className="text_hidden";
		document.getElementById(id).className="text_hidden";
	}

	preVal=id;
}


var preVal2="";
/*function expandContentBold2(id)
{  
	
	if(preVal2!="" && preVal2!=id)
	{
		document.getElementById("bullet_"+preVal2).src="img/info_on.gif";
		//document.getElementById("a"+preVal).className="normal";
		//document.getElementById("w"+preVal).className="text_hidden";
		document.getElementById(id).className="text_hidden";
		preVal="";
	}
	val=((document.getElementById(id).className)=="text_hidden")? true:false;
	//alert(document.getElementById("bullet_"+id));
	alert(document.getElementById("bullet_"+id).src);
	if(val)
	{
		document.getElementById("bullet_"+id).src="img/info_off.gif";
		//document.getElementById("a"+id).className="hand";
		//document.getElementById("w"+id).className="text_visible";
		document.getElementById(id).className="text_visible";
	}
	else
	{
		document.getElementById("bullet_"+id).src="img/info_on.gif";
		//document.getElementById("a"+preVal).className="normal";
		//document.getElementById("w"+id).className="text_hidden";
		document.getElementById(id).className="text_hidden";
	}

	preVal2=id;
}*/ 

function expandContentBold2(id)
{  
	var onOffFlag = document.getElementById("hidden_" + id).value;
	//alert(onOffFlag);
	if(onOffFlag == 'on')
	{
		document.getElementById("hidden_" + id).value = 'off';
		document.getElementById("bullet_" + id).src = 'img/info_on.gif';
		document.getElementById(id).className = 'text_hidden';
	}
	else
	{
		document.getElementById("hidden_" + id).value = 'on';
		document.getElementById("bullet_" + id).src = 'img/info_off.gif';
		document.getElementById(id).className = 'text_visible';
	}
}


//search validation

// Check Text or Not
function isText(str)
{
	var i=0;
	if(str.charAt(0)==' ')i++;
	while(i<str.length)
	{
		if (str.charAt(i)>='0' && str.charAt(i)<= '9' || str.charAt(i)=='+' || str.charAt(i)=='-' || str.charAt(i)=='*' || str.charAt(i)=='/' || str.charAt(i)=='\\' || str.charAt(i)=='\'' || str.charAt(i)=='@' || str.charAt(i)=='!' || str.charAt(i)=='~' || str.charAt(i)=='`' || str.charAt(i)=='#' || str.charAt(i)=='$' || str.charAt(i)=='%' || str.charAt(i)=='^' || str.charAt(i)=='&' || str.charAt(i)=='(' || str.charAt(i)==')' || str.charAt(i)=='_' || str.charAt(i)=='=' || str.charAt(i)=='?' || str.charAt(i)=='.' || str.charAt(i)==',' || str.charAt(i)==';' || str.charAt(i)==':' || str.charAt(i)=='"' || str.charAt(i)=='{' || str.charAt(i)=='}' || str.charAt(i)=='[' || str.charAt(i)==']' || str.charAt(i)=='<' || str.charAt(i)=='>' || str.charAt(i)=='|')
		return false;
		i++;
	}
	return true;
}

// Check Phone Number or not
function isTelephoneNumber(str)
{
	var i=0;
	if(str.charAt(0)=='+')i++;
	while(i<str.length)
	{
		if (!(str.charAt(i)>='0' && str.charAt(i)<= '9' || str.charAt(i)==' ' || str.charAt(i)=='-' || str.charAt(i)=='(' || str.charAt(i)==')') )
			return false;
		i++;
	}
	return true;
}

// Check Phone Number length
function isLength(str)
{
	var len=str.length;
		if(len<10)
		{
			return false;
		}
		return true;
}

// Check Number or Not
function isNumeric(str)
{
	var i=0;
	while(i<str.length)
	{
		if (!(str.charAt(i)>='0' && str.charAt(i)<= '9' || str.charAt(i)==' '))
		return false;
		i++;
	}
	return true;
}

// Remove the empty space
function trim(String)
{
   if (String == null)
   {   
   	return ("");
   }
   return String.replace(/(^\s+)|(\s+$)/g,"");
}

// Check the E-Mail Id
function isMailid(str) 
{
	var emailPat = /^[\w-\.]+\@[\w\.-]+\.[a-z]{2,4}$/;
	var matchArray = str.match(emailPat);
		if (matchArray == null)
		{
		alert("Invalid E-mail");
		return false;
		}
}

function searchValidation()
{
	document.searchform.query.value=trim(document.searchform.query.value);
	searchbox=document.searchform.query.value;
	if (document.searchform.query.value=="")
	{
		alert("Please enter keyword");		
		document.searchform.query.focus();		
		return false;
	}

	document.searchform.submit();
	return true;
}


//Quick links
function select1_onchange() 
{
	url=document.quick_links.select1.value;
	//alert(url)
	if (url != "")
	document.location=url;
}

// Scrollable menu code
// This Script for to get Query String URL
var sqsParm = new Array();
function mqs()
{
var query = window.location.search.substring(1);
var parms = query.split('&');
for (var i=0; i<parms.length; i++) 
{
   var pos = parms[i].indexOf('=');
   if (pos > 0) 
   {
      var key = parms[i].substring(0,pos);
      var val = parms[i].substring(pos+1);
      sqsParm[key] = val;
    }
 }
   return sqsParm["id"];
}


//*********To set the frame height based on the frame content length
function getDocHeight(doc) 
{
	  var docHt = 0, sh, oh;
	  if (doc.height) docHt = doc.height;
	  else if (doc.body) 
	  {
		if (doc.body.scrollHeight) docHt = sh = doc.body.scrollHeight;
		if (doc.body.offsetHeight) docHt = oh = doc.body.offsetHeight;
		if (sh && oh) docHt = Math.max(sh, oh);
	  }
	  return docHt;
}
function getDocWidth(doc) 
{
	  var docWt = 0, sh, oh;
	  if (doc.height) docWt = doc.width;
	  else if (doc.body) 
	  {
		if (doc.body.scrollWidth) docWt = sh = doc.body.scrollWidth;
		if (doc.body.offsetWidth) docWt = oh = doc.body.offsetWidth;
		if (sh && oh) docWt = Math.max(sh, oh);
	  }
	  return docWt;
}
function setIframeHeight(iframeName) 
{
	  var iframeWin = window.frames[iframeName];
	  var iframeEl = document.getElementById? document.getElementById(iframeName): document.all? document.all[iframeName]: null;
	  if ( iframeEl && iframeWin ) 
	  {
		iframeEl.style.height = "auto"; 
		var docHt = getDocHeight(iframeWin.document);
		var docWt = getDocWidth(iframeWin.document);
		if (docHt) iframeEl.style.height = docHt + 0 + "px";
		if (docWt) iframeEl.style.width = docWt + 0 + "px";
	  }
}