    //<![CDATA[

    var map;
    var gdir;
    var geocoder = null;
    
    function loadMap(large) {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map"));
        map.addControl(large ? new GLargeMapControl(): new GSmallMapControl());
        map.addControl(new GMapTypeControl(), new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10, 10)));
        gdir = new GDirections(map, document.getElementById("directions"));
        GEvent.addListener(gdir, "load", onGDirectionsLoad);
        GEvent.addListener(gdir, "error", handleErrors);

        geocoder = new GClientGeocoder();
      }
    }

    function showAddress(address) {
		  geocoder.getLatLng(
		    address,
		    function(point) {
		      if (!point) {
		        alert(address + " not found");
		      } else {
		        map.setCenter(point, 13);
		        //var icon = new GIcon();
		        //icon.image = "http://www.iqrava.org/mediac/400_0/media/" + (address = destination ? "iqralogo.gif": "students.gif");
			//icon.shadow = "http://www.google.com/mapfiles/shadow50.png";
			//icon.iconSize = new GSize(20, 34);
                        //icon.shadowSize = new GSize(37, 34);
		        var marker = new GMarker(point);
		        map.addOverlay(marker);
		        marker.openInfoWindowHtml(address);
		      }
		    }
		  );
    }

    function setDirections(fromAddress, toAddress, locale) {
      showAddress(toAddress);
      gdir.load("from: " + fromAddress + " to: " + toAddress, { "locale": locale });
    }

    function handleErrors(){
	   if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
	     alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: " + gdir.getStatus().code);
	   else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
	     alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: " + gdir.getStatus().code);

	   else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
	     alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: " + gdir.getStatus().code);

	//   else if (gdir.getStatus().code == G_UNAVAILABLE_ADDRESS)  <--- Doc bug... this is either not defined, or Doc is wrong
	//     alert("The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.\n Error code: " + gdir.getStatus().code);

	   else if (gdir.getStatus().code == G_GEO_BAD_KEY)
	     alert("The given key is either invalid or does not match the domain for which it was given. \n Error code: " + gdir.getStatus().code);

	   else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
	     alert("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code);

	   else alert("An unknown error occurred.");

	}

	function onGDirectionsLoad(){
          // Use this function to access information about the latest load()
          // results.

          // e.g.
	  // document.getElementById("getStatus").innerHTML = gdir.getStatus().code;
	  // and yada yada yada...
	}

	  //
	  // Check if the value in empty
	  //
	  function isValueEmpty(value)
	  {
	     return !(value != null && value != "")
	  }

	 //
	  // Use This function to expand and colapse data
	  //
	  function expandcolapse(displayId,signId,cookieName,getCookiefl)
	   {     
	     var displayValue = document.getElementById(displayId).style.display;
	     if (displayValue == 'none')
		displayValue = 'inline';
	     else
		displayValue = 'none';    
	     if (!isValueEmpty(cookieName))
	     {
		//here I check if the cokiee exists if not save the cokiee with the opposit of current div state
		//if the cokiee exists and getCookie is true then set the div state to the cokiee      
		//else set the cokiee to the div state
		if(checkCookie(cookieName))
		{
		  if(!isValueEmpty(getCookiefl))
		  {
		    displayValue = getCookie(cookieName);
		  }
		  else
		  {
		    setCookie(cookieName,displayValue,'1')
		  }
		}
		else
		{
		  setCookie(cookieName,displayValue,'1')
		}
	     }
	     if(!isValueEmpty(signId))
	     {
	       if(displayValue == 'none')
		 document.getElementById(signId).innerHTML = '(+)';   
	       else          
		 document.getElementById(signId).innerHTML = '(-)';            
	     }   
	     document.getElementById(displayId).style.display = displayValue;
	   }

	   function getCookie(c_name)
	   {
	   if (document.cookie.length>0)
	     {
	     c_start=document.cookie.indexOf(c_name + "=")
	     if (c_start!=-1)
	       { 
	       c_start=c_start + c_name.length+1 
	       c_end=document.cookie.indexOf(";",c_start)
	       if (c_end==-1) c_end=document.cookie.length
	       return unescape(document.cookie.substring(c_start,c_end))
	       } 
	     }
	   return ""
	   }


	   function setCookie(c_name,value,expiredays)
	   {
	   var exdate=new Date()
	   exdate.setDate(exdate.getDate()+expiredays)
	   document.cookie=c_name+ "=" +escape(value)+
	   ((expiredays==null) ? "" : ";expires="+exdate.toGMTString())
	   }


	   function checkCookie(cookieName)
	   {
	     cookieValue=getCookie(cookieName)
	     if (cookieValue!=null && cookieValue!="")
	     {
	       return true;
	     }
	     else
	     {
	       return false;
	     }
	   }


    //]]>