
var existingMarkers = new Array();
var currentGGLMarkers = new Array();

function hideElement(elementId){
	if(document.getElementById(elementId)){
		document.getElementById(elementId).style.display = 'none';
	}
}

function showElement(elementId){
	if(document.getElementById(elementId)){
		document.getElementById(elementId).style.display = '';
	}
}

var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height){
  if(popUpWin) popUpWin.focus();
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function loadCorrectSizedSWF(){
	currHeight = document.getElementById('pageContentContainer').offsetHeight;
	width = 358;
	//alert(currHeight);
	if(currHeight<440){
		height = 240;
		swfPhotos = 'sp1_358x240.swf';
	}
	else if(currHeight<700){
		height = 440;
		swfPhotos = 'sp2_358x390.swf';
	}
	else if(currHeight<1000){
		height = 650;
		swfPhotos = 'sp3_358x600.swf';
	}
	else if(currHeight>=1000){
		height = 690;
		swfPhotos = 'sp4_358x690.swf';
	}
    
   swfCode = '<object type="application/x-shockwave-flash" data="/f/' + swfPhotos + '" id="photoSwf" width="'+width+'" height="'+height+'">';
	swfCode = swfCode+'<param name="movie" value="/f/' + swfPhotos + '" />';
	swfCode = swfCode+'<param name="quality" value="high" />';
	swfCode = swfCode+'<param name="wmode" value="transparent" />';
	swfCode = swfCode+'</object>';
	document.getElementById('sidePhotosContainer').innerHTML = swfCode;
    outgoing_links();
}

function outgoing_links()
{
	// Attach onclick event to all links.
    $('a').click( function() {
        var trackExtensions = '7z|aac|avi|csv|doc|exe|flv|gif|gz|jpe?g|js|mp(3|4|e?g)|mov|pdf|phps|png|ppt|rar|sit|tar|torrent|txt|wma|wmv|xls|xml|zip|docx|xlsx';
		// Expression to check for absolute internal links.
        var isInternal = new RegExp("^(https?):\/\/" + window.location.host, "i");
        // Expression to check for special links like gotwo.module /go/* links.
        var isInternalSpecial = new RegExp("(\/go\/.*)$", "i");
        // Expression to check for download links.
        var isDownload = new RegExp("\\.(" + trackExtensions + ")$", "i");
    
        // Is the clicked URL internal?
        if (isInternal.test(this.href)) {
        // Is download tracking activated and the file extension configured for download tracking?
            if (isDownload.test(this.href)) {
            // Download link clicked.
                var extension = isDownload.exec(this.href);
                _gaq.push(["_trackEvent", "Downloads", extension[1].toUpperCase(), this.href.replace(isInternal, '')]);
            }
            else if (isInternalSpecial.test(this.href)) {
                // Keep the internal URL for Google Analytics website overlay intact.
                _gaq.push(["_trackPageview", this.href.replace(isInternal, '')]);
            }
		}
        else {
        	if ($(this).is("a[href^=mailto:],area[href^=mailto:]")) {
            // Mailto link clicked.
            _gaq.push(["_trackEvent", "Mails", "Click", this.href.substring(7)]);
            }
            else if (this.href) {
              // External link clicked.
              _gaq.push(["_trackEvent", "Outgoing links", "Click", this.href]);
            }
        }
  });
	
}


