//for including other js file on the bottom of this file

popup_result_func='';

function popup(url,width,height,result_func,scroll)
{
    window.status='';
    popup_result_func=result_func;
    posix=((screen.width-width)/2);
    posiy=((screen.height-height)/2);
    while(url.indexOf('?')!=-1) url=url.replace("?","%3F");
    while(url.indexOf('&')!=-1) url=url.replace("&","%26");
    while(url.indexOf('=')!=-1) url=url.replace("=","%3D");
    alert(url);
    if (!document.all)
    {
        temp=top.showModalDialog('/city_info/popup.cfm?page='+url+'&scroll='+scroll,'PopUp','dialogWidth:'+width+'px; dialogHeight:'+(height+20)+'px;help:0;status:no;');
        if (temp) popup_result(temp);
        else if (temp==0) popup_result(temp);
    }
    else
    {
        PopUp=window.open('/city_info/popup.cfm?page='+url+'&scroll='+scroll,'PopUp','width='+width+',height='+height+',left='+posix+',top='+posiy+',resizable=no');
    }
}
    
function popup_result(result)
{
    eval(popup_result_func+'(result)');
}

function ansicht(obj,eventover) {
	
	if (eventover) {
		$('#boerse_img_main').attr('src',obj.alt);
	} else {
		$('#boerse_img_main').attr('src',$('#boerse_img_main').alt);
	}
}

function countElementsByClass(className, elementTag){
	var count = new Array();
	var elements = document.getElementsByTagName(elementTag);
	for (var i = 0; i < elements.length; i++){
		if (elements[i].className == className){
			count[i] = "";
		}
	}
	return count.length;
}

function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}

//additional js function
var includedCSS = Array();

function includeCSSfile(href) {	

	
		var head_node = document.getElementsByTagName('head')[0];
		var link_tag = document.createElement('link');
		link_tag.setAttribute('rel', 'stylesheet');
		link_tag.setAttribute('type', 'text/css');
		link_tag.setAttribute('href', href);
		head_node.appendChild(link_tag);
			
}

// JavaScript Document by Quang Mai Duy | quangmd@g3ws.com
function includejs_outside(jsfile) {
   document.write ("<" + "script language='JavaScript' type='text/javascript' src='");
   document.write (jsfile);
   document.write ("'><" + "/script>");
}
function includejs(jsfile) {
   document.write ("<" + "script language='JavaScript' type='text/javascript' src='");
   document.write ('/city_info/include/' + jsfile);
   document.write ("'><" + "/script>");
}

function createIframe(iframeName, width, height, srcs) {
	var iframe;
	if (document.createElement && (iframe =
		document.createElement('iframe'))) {
		iframe.name = iframe.id = iframeName;
		iframe.width = width;
		iframe.height = height;
		iframe.src = srcs;
		document.body.appendChild(iframe);
	}
	return iframe;
}
//createIframe('adv',0,0,'http://ads.activecity.net');

/* for the quick admin */
var curhome = "";

function set_screen_home(num,url)		//managedWindow.home setzen
{
	curhome=url;
}

function open_home()					//managedWindow.home öffnen
{
	alert(curhome);
	$("#TB_iframeContent").src=curhome;
}

/* for the quick admin */

window.dhx_globalImgPath="./images/";

if (typeof(js_files_processed)=='undefined') {
	
	
	
	//includejs_outside('http://code.jquery.com/jquery-latest.js');
	
	includejs('jquery.js');
	
	includejs('jsadditional.js');
	//includejs('preferences.js');
	includejs('mycookie.js');
	includejs('system.js');
	includejs('swapstyle.js');
	includejs('myloader.js');
	//includejs('helppanel.js');
	//includejs('tooltip.js');
	
	includejs('pausescroller.js');
	
	includejs('motionpack.js');
	includejs('tabcontent.js');
	
/*	includejs('jScrollPane.js');
	includeCSSfile('/city_info/include/jScrollPane.css');*/
	
	includejs('swfobject.js');
	
	//http://thomlx.free.fr/jquery/jquery_carousel.htm
	includejs('jquery.carousel.min.js');
	
	includejs_outside("http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js");		
	
	//http://workshop.rs/2009/12/image-gallery-with-fancy-transitions-effects/
	includejs('jqFancyTransitions.1.7.min.js');
	
	includejs('jquery.simpletip-1.3.1.js');
	
	includejs('jquery.simplyscroll-1.0.4.min.js');
	
	includejs('jquery.smoothDivScroll-1.1-min.js');
	//includejs('jquery.glider.js');
	
	includejs('thickbox.js');
	
	includeCSSfile('/city_info/include/thickbox.css');
		

}

js_files_processed = true;
