// teste auf Frames

function frametest()
{
	if(top.frames.length > 0)
	top.location.href=self.location;
}


function zoomOutPage(){
	if (Math.max(navigator.userAgent.toLowerCase().indexOf('msie'),0)){
		if(window.parent.document.body.style.zoom!=0){
			window.parent.document.body.style.zoom/=1.2;
		}else{
			window.parent.document.body.style.zoom=1/1.2;
		}
	} else {

	}
}

function scaleContent(typ, style_obj, css_class_name){
	if(css_class_name == ".text"){
	
		var px_pos = style_obj.style.fontSize.indexOf('px');
		var px = style_obj.style.fontSize.substr(0, px_pos);
			px = parseInt(px);
		
		if(typ == "in"){			
			px += 2;			
			style_obj.style.fontSize = px+'px';
		} else {			
			if(px > 2){
				px -= 2;
				style_obj.style.fontSize = px+'px';
			}
		}
	}
}

function getIEVersion(){
	var user_agent = navigator.userAgent.toLowerCase();
	var version = user_agent.substr(user_agent.indexOf('msie')+5, 1);
	return version;
}

function zoomInPage(){
	if (Math.max(navigator.userAgent.toLowerCase().indexOf('msie'),0)){
		/*if(window.parent.document.body.style.zoom!=0){
			window.parent.document.body.style.zoom*=1.2;
		}else{
			window.parent.document.body.style.zoom=1.2;
		}*/
		
		
		var ie_version = getIEVersion();
			
		if(ie_version == 7 || ie_version == 5){
			var frame_doc =  document;
			var debug_text = '';
						
			for(var classes = 0; classes < frame_doc.styleSheets.length; classes++){
				debug_text = debug_text + frame_doc.styleSheets[classes].rules + "\n";
				try {
					var styleRules = frame_doc.styleSheets[classes].rules;
									
					for(var rulesIndex = 0; rulesIndex < styleRules.length; rulesIndex++){
						if(styleRules[rulesIndex].style.cssText != null){
							var cssValueText = styleRules[rulesIndex].selectorText;						 
							debug_text = debug_text + cssValueText.toLowerCase() +"<br>";
							if(cssValueText.length > 0){							
								scaleContent("in", frame_doc.styleSheets[classes].rules[rulesIndex], cssValueText.toLowerCase());
							}
						}
						
					}
				} catch(e){}
			}
		} else {				
			var frame_doc = document;
			var debug_text = '';
						
			for(var classes = 0; classes < frame_doc.styleSheets.length; classes++){					
				try {					
					var styleRules = frame_doc.styleSheets[classes].rules;

					for(var rulesIndex = 0; rulesIndex < styleRules.length; rulesIndex++){
						if(styleRules[rulesIndex].style.cssText != null){
							var cssValueText = styleRules[rulesIndex].selectorText;						 
							debug_text = debug_text + cssValueText.toLowerCase() +"<br>";
							if(cssValueText.length > 0){							
								scaleContent("in", frame_doc.styleSheets[classes].rules[rulesIndex], cssValueText.toLowerCase());
							}
						}

					}
				} catch(e){}
			}
		}
	} else {						
		var doc = document;
		var debug_text;
		for(var classes = 0; classes < doc.styleSheets.length; classes++){				
			try {			
				var styleRules = doc.styleSheets[classes].cssRules;
								
				for(var rules = 0; rules < styleRules.length; rules++){					
					var cssValueText = styleRules[rules].cssText;
					var cssClassIdName = cssValueText.substr(0,cssValueText.indexOf('{')-1); 
					debug_text = debug_text + cssClassIdName + "\n";
					if(cssClassIdName.length > 0){
						scaleContent("in", styleRules[rules], cssClassIdName.toLowerCase());
					}
				}
			} catch(e){}		
		
		}	
	}
}

//<![CDATA[ Google Maps
var WINDOW_HTML = '<strong>Heidelberger Klinik</strong><br>Brückenkopfstraße 1-2<br>69120 Heidelberg';
var map = null;
var geocoder = null;
  
    function load() {
      if (GBrowserIsCompatible()) {
	    mapDiv = document.getElementById("map");
        map = new GMap2(mapDiv);
		map.addControl(new GLargeMapControl());
		map.addControl(new GMapTypeControl());
		// zoom durch doppelklick ermoeglichen
        map.enableDoubleClickZoom();
        map.enableContinuousZoom();
        // zoom durch mausrad ermoeglichen
		GMap2.prototype.wheelZoom = function(event)
         { if(event.cancelable)    event.preventDefault(); 
		   if((event.detail || -event.wheelDelta) < 0)
           { map.zoomIn();} else { map.zoomOut();}
         return false;
  		}
  		GEvent.addDomListener(mapDiv, "DOMMouseScroll", map.wheelZoom);
  		GEvent.addDomListener(mapDiv, "mousewheel", map.wheelZoom); 

        geocoder = new GClientGeocoder();
		rect = new GLatLngBounds();
		showAddress("Brückenkopfstraße 1-2, 69120 Heidelberg");
      }
    }

    function showAddress(address, window_html, index) {
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
			  var icon = new GIcon();
			  icon.iconSize = new GSize(12, 20);
			  icon.shadowSize = new GSize(22, 20);
			  icon.iconAnchor = new GPoint(6, 20);
			  icon.infoWindowAnchor = new GPoint(5, 1);
			  map.setCenter(point, 13);
              var marker = new GMarker(point, icon);
              map.addOverlay(marker);
			  GEvent.addListener(marker, 'click', function() {marker.openInfoWindowHtml(window_html);});
			  marker.openInfoWindowHtml(WINDOW_HTML);
          }
        );
      }
    }
//]]>
