/* all global javascript functions are defined here */

function SwitchMenu(obj){
   if(document.getElementById){
   var el = document.getElementById(obj);
      if(el.style.display != ""){
         el.style.display = "";
		 //document.getElementById("test").style.visibility="hidden";
      }else{
         el.style.display = "none";		 
      }
	  
   }
}

function change(param1,plusminusatag)
{
		animatedcollapse.toggle(param1);
}

function toggleInner(cid,lid){
animatedcollapse.toggle(cid);
changeImage(lid);
}

function changeImage(id){
if(document.getElementById(id).style.backgroundImage.indexOf('down_arrow') > 0){
$("#"+id).css("background", "url(/presentation/bettertheworld/en-us/images/list_arrow.gif) no-repeat 0 4px");
}
else{
$("#"+id).css("background", "url(/presentation/bettertheworld/en-us/images/down_arrow.gif) no-repeat 0 4px");
}
}
function toggleLayer( whichLayer )
{
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}

function checkSpecialChar(fieldValue){
	var strValue=fieldValue;
	var cnt;
	for(var cnt=0;cnt<strValue.length; cnt++){
		if((strValue.charAt(cnt)>='A' && strValue.charAt(cnt) <='Z') || (strValue.charAt(cnt)>='a' && strValue.charAt(cnt) <='z') || (strValue.charAt(cnt)>='0' && strValue.charAt(cnt) <='9') || strValue.charAt(cnt)==' ' || strValue.charAt(cnt)=='-') {
	
		}
		else {
			return false;
		}
	}
	return true;
}