/* zonex header bookmark */
function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
}
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}


/* pligg checkForm */
function checkForm() {
			answer = true;
			if (siw && siw.selectingSomething)
				answer = false;
			return answer;
			}//



/* find doctors and drugs comments page */
function FCKeditor_OnComplete( editorInstance )
{
	var oCombo = document.getElementById( 'cmbSkins' ) ;

	// Get the active skin.
	var sSkin = editorInstance.Config['SkinPath'] ;
	sSkin = sSkin.match( /[^\/]+(?=\/$)/g ) ;

	oCombo.value = sSkin ;
	oCombo.style.visibility = '' ;
}


/* find doctors and drugs show_dr page */
function load(lat,long) {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.addControl(new GSmallMapControl());
        map.setCenter(new GLatLng(lat, long), 13);
        var marker = new GMarker(new GLatLng(lat, long));
      	map.addOverlay(marker);
      }
    }
	
	
/* find doctors and drugs search box */	
function showID(text){
 if(document.getElementById(text).style.display=="none") 
 document.getElementById(text).style.display="block"; 
 else document.getElementById(text).style.display="none";}



/* find doctors and drugs contact page */
function validate_form ( )
{
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
var address = document.update_form.Email.value;

if(reg.test(address) == false) {
      alert('Invalid Email Address');
      document.update_form.Email.focus()
	  return false
   }
    valid = true;

    if ( document.update_form.Name.value == "" )
    {
        alert ( "Please fill in the required 'Name' field." );
       	document.update_form.Name.focus()
		return false
    }
	
	if ( document.update_form.Address.value == "" )
    {
        alert ( "Please fill in the required 'Address' field." );
       	document.update_form.Address.focus()
		return false
    }
	
	if ( document.update_form.City.value == "" )
    {
        alert ( "Please fill in the required 'City' field." );
       	document.update_form.City.focus()
		return false
    }
	
	if ( document.update_form.State.options[0].selected )
    {
        alert ( "Please select your 'State'." );
       	document.update_form.State.focus()
		return false
    }
	
	if ( document.update_form.Zip.value == "" )
    {
        alert ( "Please fill in your 'ZIP' code." );
       	document.update_form.Zip.focus()
		return false
    }
	
	if ( document.update_form.Credentials.value == "" )
    {
        alert ( "Please fill in the required 'Credentials'." );
       	document.update_form.Credentials.focus()
		return false
    }
	
	if ( document.update_form.Speciality.options[0].selected )
    {
        alert ( "Please select your 'Speciality'." );
       	document.update_form.Speciality.focus()
		return false
    }
	
   return true;
	
 }


/* jquery functions */
$(document).ready(function(){
	
	//box corner
	$(".box12").corner("12px");
	$("#ency_body > form").corner("12px");
	$(".namespaceoptions").corner("12px");
	
});

//Object for detecting the browser type
/** comment: turned off
var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			   string: navigator.userAgent,
			   subString: "iPhone",
			   identity: "iPhone/iPod"
	    },
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();
*/


//function for setting the homepage on
function setHomepage(url)
{

 if (BrowserDetect.browser == 'Explorer')
    {
        document.body.style.behavior='url(#default#homepage)';
		document.body.setHomePage(url);
 
    }
    else if (BrowserDetect.browser == 'Firefox')
    {
    if(window.netscape)
    {
         try
   {  
            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
         }  
         catch(e)  
         {  
    alert("this action was aviod by your browser,if you want to enable,please enter about:config in your address line,and change the value of signed.applets.codebase_principal_support to true");  
         }
    } 
    var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
    prefs.setCharPref('browser.startup.homepage',url);
	
    }else if (BrowserDetect.browser == 'Opera'){
		
	//to do
	
	}else if( BrowserDetect.browser =='Safari'){

	//to do
		
	}
}