/* <![CDATA[ */

/*
 * COMMON SITE FUNCTIONS FOR INCOTEC.AT
 * Version: 1.0(30/10/2011)
 * Copyright (c) 2011 Bernhard Stranz
 * Requires: jQuery v1.4+
*/

jQuery(document).ready(function($) {

//if google map layer !empty initMap
if ($("#map").length>0) { initLoader(); }

//newsticker
$('marquee').marquee();
	
//animate subnav
$(".page-left ul li a").not(".page-left ul li a.selected").hover(function(){
			$(this).stop().animate({
				paddingRight: "0px"
				}, 200);
			}, function(){
				$(this).stop().animate({
				paddingRight: "10px"
			}, 200);
	});


$(".fancybox").fancybox({
			'titlePosition'	: 'over',
			'padding' : 0,
			'margin' : 0,
			'overlayOpacity' : 0.7,
			'overlayColor' : '#FFF'
			});

				
/*
$('.campaign a').each(function()
   { 
      $(this).attr({ target: ""});	
	  $(this).fancybox({ 'hideOnContentClick': false, 'titleShow'	: false,'padding' : 0,	'margin' : 0,'overlayOpacity' : 0.7,'overlayColor' : '#FFF','width' : 700,'height' : 500,'type' : 'iframe' });
   });
*/


}); //document ready

///////////////////////////////////////////////////////////////////////////////
// EMAIL SCRAMBLER
///////////////////////////////////////////////////////////////////////////////

function e(a){var b,c;c='';for(b=0;b<a.length;b++){c=String.fromCharCode(a.charCodeAt(b)^1)+c;}return c;}
function f(a){var b=e(a);document.write(e(';numh`l#<gdsi!`=')+b+e('?#')+b+e('?`.='));}

///////////////////////////////////////////////////////////////////////////////
// GOOGLE MAPS KARTE
///////////////////////////////////////////////////////////////////////////////

function loadMaps() {
  google.load("maps", "2", {"callback" : initMap});
}


function initLoader() {
  var script = document.createElement("script");
  script.src = "http://www.google.com/jsapi?key=ABQIAAAA08qhlzLOKVtKXAPCbuQn0xRJa0MeI90Q1uCuUDb0tnNMv95fVBQACTbpRBBTNbM7HsSJYfXkdWjVCg&callback=loadMaps";
  script.type = "text/javascript";
  document.getElementsByTagName("head")[0].appendChild(script);
}

 //var centerLatitude = 47.80279;  
// var centerLongitude = 16.23318;  
 var centerLatitude = 47.96482;  
 var centerLongitude = 16.21385;  

 var description = 'Dom';  
   
 var startZoom = 8;  
 var map;  
   
 var gmarkers = [];  
 var htmls = [];  
 var to_htmls = [];  
 var from_htmls = [];  
 var i=0;  
 
  
 function createMarker(point,name,html) {  
	
	var icon_incotec = new GIcon();
	icon_incotec.image = "/_assets/img/icon_map.png";
	icon_incotec.shadow = "/_assets/img/icon_map-shadow.png";
	icon_incotec.iconSize = new GSize(32.0, 37.0);
	icon_incotec.shadowSize = new GSize(51.0, 37.0);
	icon_incotec.iconAnchor = new GPoint(16.0, 37.0);
	icon_incotec.infoWindowAnchor = new GPoint(16.0, 18.0);

     var marker = new GMarker(point,icon_incotec); //markerOptions  
   
	to_htmls[i] = html + '<br><br>Route: <b>Hierher</b> - <a href="javascript:fromhere(' + i + ')" class="readmore">Von hier</a>' +  
         '<br><br>Start Adresse:<form action="http://maps.google.com/maps" method="get" target="_blank">' +  
         '<input type="text" SIZE=40 MAXLENGTH=40 name="saddr" id="saddr" value="" /><br>' +  
         '<INPUT value="Zeige Route" TYPE="SUBMIT">' +  
         '<input type="hidden" name="daddr" id="daddr" value="' + point.lat() + ',' + point.lng() + '"/>' +
         '</form>'; 
   
     from_htmls[i] = html + '<span class="text"><br><br>Route: <a href="javascript:tohere(' + i + ')" class="google">Hierhin</a> - <b>Von hier</b>' +  
        '<br><br>Ziel Addresse:</span><form action="http://maps.google.com/maps" method="get"" target="_blank">' +  
         '<input type="text" SIZE=40 MAXLENGTH=40 name="daddr" id="daddr" value="" /><br>' +  
         '<INPUT value="Zeige Route" TYPE="SUBMIT">' +  
         '<input type="hidden" name="saddr" value="' + point.lat() + ',' + point.lng() +  
             // "(" + name + ")" +   
         '"/>';  
   
     html = html + '<span class="text"><br><br><b>Route berechnen:</b> <a href="javascript:tohere('+i+')" class="readmore">Hierher</a> - <a href="javascript:fromhere('+i+')" class="readmore">Von hier</a></span>';  
   
     GEvent.addListener(marker, "click", function() { 
         marker.openInfoWindowHtml(html); 
     }); 
     gmarkers[i] = marker; 
     htmls[i] = html; 
     i++; 
     return marker; 
 } 
  
 function tohere(i) { 
     gmarkers[i].openInfoWindowHtml(to_htmls[i]); 
 } 
  
 function fromhere(i) { 
     gmarkers[i].openInfoWindowHtml(from_htmls[i]); 
 } 
 
  
 function initMap() { 
     if (GBrowserIsCompatible()) { 
	 
         map = new GMap2(document.getElementById("map")); 
         map.setCenter(new GLatLng(centerLatitude, centerLongitude), startZoom); 
		 map.setUIToDefault();
		 map.hideControls();
  		 map.enableContinuousZoom();
		 map.enableDoubleClickZoom();
	
		GEvent.addListener(map, "mouseover", function(){map.showControls();});
		GEvent.addListener(map, "mouseout", function(){map.hideControls();});

  
         var point1 = new GLatLng(47.700332,16.028232); 
         var marker1 = createMarker(point1,description,'<b>INCOTEC</b><br /><b>Handels und Dienstleistungs GmbH.</b><br />Bundesstraße 32, A-2632 Wimpassing')  
         map.addOverlay(marker1);

         var point2 = new GLatLng(48.076666804336284,16.311553716659546); 
         var marker2 = createMarker(point2,description,'<b>INCOTEC H3C Competence Center</b><br />Brown Boveri Straße 6/1/6<br />A-2351 Wiener Neudorf')  
         map.addOverlay(marker2);
	 	 
		// GEvent.trigger(marker1, "click"); 

     }  
     else {  
         alert("Dein Browser unterst&uuml;tzt nicht Google Maps!"); 
     } 
 }  


/* ]]> */

