
//Custom JS

window.onload = init;
function init(){
	if(typeof sIFR == "function"){
		sIFR.replaceElement(named({sSelector:"body h1", sWmode:"true", sFlashSrc:"/customizations/neable_org/Library/images/BrowalliaNew.swf", sColor:"#ffffff", sLinkColor:"#ffffff", sBgColor:"#0066B3", sHoverColor:"#ffffff", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"textalign=left"}));
		sIFR.replaceElement(named({sSelector:"body h2", sWmode:"true", sFlashSrc:"/customizations/neable_org/Library/images/BrowalliaNew.swf", sColor:"#ffffff", sLinkColor:"#ffffff", sBgColor:"#0066B3", sHoverColor:"#ffffff", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"textalign=left"}));
		sIFR.replaceElement(named({sSelector:"body h3", sWmode:"true", sFlashSrc:"/customizations/neable_org/Library/images/BrowalliaNew.swf", sColor:"#ffffff", sLinkColor:"#ffffff", sBgColor:"#0066B3", sHoverColor:"#ffffff", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"textalign=left"}));
		sIFR.replaceElement(named({sSelector:"body h4", sWmode:"true", sFlashSrc:"/customizations/neable_org/Library/images/BrowalliaNew.swf", sColor:"#ffffff", sLinkColor:"#ffffff", sBgColor:"#0066B3", sHoverColor:"#ffffff", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"textalign=left"}));
		sIFR.replaceElement(named({sSelector:"body h5", sWmode:"true", sFlashSrc:"/customizations/neable_org/Library/images/BrowalliaNew.swf", sColor:"#ffffff", sLinkColor:"#ffffff", sBgColor:"#0066B3", sHoverColor:"#ffffff", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"textalign=left"}));
	};
}


// Standard JS functions
function hide(el){
    if(document.getElementById){
    	document.getElementById(el).style.display = 'none';
    }else if(document.all){
    	document.all.el.style.display = 'none';
	}
}

function show(el){
	if(document.getElementById){
		document.getElementById(el).style.display = 'inline'
	}else if(document.all){
		document.all.el.style.display = 'inline'
	}
}

function block_show(el){
	if(document.getElementById){
		document.getElementById(el).style.display = 'block'
	}else if(document.all){
		document.all.el.style.display = 'block'
	}
}

function tog(el){
	if(document.getElementById){
		if(document.getElementById(el).style.display == 'inline'){
			hide(el);
		}else{
			show(el);
		}
	}else if(document.all){
		if(document.all.el.style.display = 'inline'){
			hide(el);
		}else{
			show(el);
		}		
	}
}


if (navigator.appName == 'Netscape') var language = navigator.language;
else var language = navigator.browserLanguage;
var color = screen.colorDepth;
var res = screen.width+'x'+screen.height;

var flash = new Object();
flash.installed = false;
flash.version = '0.0';
flash_versions = 20;

if (navigator.plugins && navigator.plugins.length) {
	for (x=0; x < navigator.plugins.length; x++) {
		if (navigator.plugins[x].name.indexOf('Shockwave Flash') != -1) {
			flash.version = navigator.plugins[x].description.split('Shockwave Flash ')[1];
			flash.installed = true;
			break;
		}
	}
}else if (window.ActiveXObject) {
	for (x = 2; x <= flash_versions; x++) {
		try {
			oFlash = eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash." + x + "');");
			if(oFlash) {
				flash.installed = true;
				flash.version = x + '.0';
			}
		}
		catch(e) {}
	}
}

document.cookie = "language="+language;
document.cookie = "color="+color;
document.cookie = "res="+res;
document.cookie = "flash="+flash.version;


function changeImage(imageName,imagePath){
	if(document.images){
  		document[imageName].src=imagePath;
	}
}

function selectAll(formObj, isInverse, type) {

   for (var i=0;i < formObj.length;i++) {
   
      fldObj = formObj.elements[i];
      
      if (fldObj.type == type){ 
      
         if(isInverse)
            fldObj.checked = (fldObj.checked) ? false : true;
         else fldObj.checked = true; 
         
       }
       
   }
   
}


function openWin(path,theHeight,theWidth,theLeft,theTop,TOOLBAR,LOCATION,DIRECT,STATUS,MENUBAR,SCROLL,RESIZE){
	var MyWindow;
	var features='toolbar='+TOOLBAR+',';
	features+='location='+LOCATION+',';
	features+='directories='+DIRECT+',';
	features+='status='+STATUS+',';
	features+='menubar='+MENUBAR+',';
	features+='scrollbars='+SCROLL+',';
	features+='resizable='+RESIZE+',';
	features+='width='+theWidth+',height='+theHeight+',left='+theLeft+',top='+theTop;

	MyWindow=window.open(path,'MyWindow',features);
}

function validRequired(formField,fieldLabel){
	var result = true;
	
	if (formField.value == "")
	{
		alert('CREATE ALERT:\n\nPlease enter a value for the "' + fieldLabel+'"');
	    formField.style.background='yellow';
		formField.focus();
		result = false;
	}
	
	return result;
}

function validName(formField){
	var result = true;
	
	if (formField.value == "")
	{
		alert('Please enter a value for the Name');
	    formField.style.background='yellow';
		formField.focus();
		result = false;
	}
	
	if( !formField.value.match(/^[A-Za-z0-9\-]+$/g) )
	{
		alert('CREATE ALERT:\n\nYou may only enter letters numbers and dashes for the Name. \nAfter clicking OK below, I will fix your name for you.');
	    formField.value = formField.value.replace(/[^A-Za-z0-9\-]*/g,'');
	    formField.style.background='yellow';
	    formField.focus();
	    result = false;
	}
	
	return result;

}


function validURL(formField){
	var result = true;
	
	if( !formField.value.match(/^(ht|f)tp(s?)\:\/\/[a-zA-Z0-9\-\._]+(\.[a-zA-Z0-9\-\._]+){2,}(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&%\$#_]*)?$/g) )
	{
		alert('CREATE ALERT:\n\nThis is not a valid Website URL.\n\nPlease use format http://www.mydomain.com');
	    formField.style.background='yellow';
	    formField.focus();
	    result = false;
	}
	
	return result;

}


/**
    * Sets alpha-blending for transparent png's
    *
    * Internet Explorer being what is and Microsoft's pace at supporting modern file
    * formats (PNG file format; standardized circa. October 1996), this function is
    * designed to convert png's using the document.images array to support
    * transparency using alpha-blending. Unfortunately there is a side effect for
    * this 'fix'; the src attribute value will be lost.
    *
    * @author Jordon Mears, Insivia <jmears@insivia.com>
    * @return  nothing
    * @version $Revision 2.0$
    */
   function correct_png() {
   	
      for(var i=0;i<document.images.length;i++) {
         var img = document.images[i];
         var img_name = img.src.toLowerCase();
         var img_ext = img_name.substring(img_name.toUpperCase().length-3,img.src.length);

         if(img_ext == 'png') {
            img.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=\'true\',src=\'' + img.src + '\',sizingMethod=\'image\')';
            if(img.parentElement.href) {
               img.border = 0;
            }
            img.src = '/wp-content/themes/neable/images/transparent.gif';
         }
      }
   }
   
   function correct_bg_png() {

   		if(document.getElementById) {

    		image_src = document.getElementById('navigation_menu').style.backgroundImage;
    		image_src = image_src.substring(4, image_src.length-1);

	      	document.getElementById('navigation_menu').style.backgroundImage = 'none';
	      	document.getElementById('navigation_menu').style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + image_src + "',sizingMethod='scale')";
  		
   		}
         
   }

$(document).ready(function(){
    map_initialize();
});

function map_initialize() {
    if (GBrowserIsCompatible()) {
        
        var map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(41.613879, -81.519924), 12);
        map.setUIToDefault();
        
        var latlng = new GLatLng(41.613879, -81.519924);
        map.addOverlay(new GMarker(latlng));
        map.disableScrollWheelZoom();
        
    }
}

