/*
	------------------------------------
	? bluemedia, http://www.bluemedia.at
	Script by Edermayr Ronald
	Script can be used for free but this
	notice must not be removed.
	------------------------------------
*/
var URLencode = false;
var URLabspath = '/';

function decodeMail(encodedEmail) {
	var args = decodeMail.arguments;
	var email = "";
	for (i=0; i < encodedEmail.length; i+=2) {
		var letter = "";
		letter = encodedEmail.charAt(i) + encodedEmail.charAt(i+1)
		email += String.fromCharCode(parseInt(letter,16));
	}
	var label = typeof(args[1]) == "undefined" ? email : args[1];
	document.write('<a href="mailto:' + email + '">' + label + '</a>');
}

function newsletter_win() {
	var args = newsletter_win.arguments;
	if (args[0] == 2) {
		window.open('http://www.mailability.de/rieder/rieder_nl262_online.htm','newsletter_win','width=700,height=600,scrollbars=yes');
	}else{
		window.open('http://www.mailability.de/rieder/rieder_nl233_online.htm','newsletter_win','width=700,height=600,scrollbars=yes');
	}
}

function specifier_win(strLang) {
	var lang;
	if (strLang != '') lang = '?lang=' + strLang;
	window.open(URLabspath + 'farben/surfaces.asp' + lang,'surfaces','width=960,height=510,scrollbars=no');		
}

function writeSWF(movie,lang) {
	width  = 626;
	height = 210;
	var path = URLencode ? URLabspath : '';
	var language = (lang == 2) ? "en" : "de";
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="' + width + '" height="' + height + '">');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<param name="movie" value="' + path + movie + '" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="scale" value="noscale" />');
	document.write('<param name="salign" value="lt" />');
	document.write('<param name="bgcolor" value="#FFFFFF" />');
	document.write('<param name="FlashVars" value="lang=' + language + '" />');
	document.write('<embed src="' + path + movie + '" FlashVars="lang=' + language + '" quality="high" wmode="transparent" scale="noscale" salign="lt" bgcolor="#91A80C" width="' + width + '" height="' + height + '" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}

function hasFlash() {
    var requiredVersion=6;
    if (navigator.appVersion.indexOf("MSIE")!=-1&&navigator.appVersion.indexOf("Windows")>-1) {
		document.write('<script language="VBScript"\> \non error resume next \nhasFlashApp = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & '+requiredVersion+'))) \n</script\> \n');
        if (window.hasFlashApp!=null) return window.hasFlashApp
    }
    if(navigator.mimeTypes&&navigator.mimeTypes["application/x-shockwave-flash"]&&navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) {
        var b=(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description;
        return parseInt(b.charAt(b.indexOf(".")-1))>=requiredVersion
    }
    return false;
}
var FLASH_INSTALLED = hasFlash();

function printpage() {
	var url = location.href;
	if (url.indexOf("#") != -1) url = url.substr(0,url.indexOf("#"));
	if (!URLencode) {
		url = (url.indexOf('?') == -1) ? url + '?' : url + '&';
		url += 'xmltemplate=PrintTemplate.xml';
	} else {
		url += '/xmltemplate/PrintTemplate.xml';
	}
	window.open(url,'printwin','width=630,height=500,scrollbars=yes');
}

// --- mouseover-functions for browsers with dom-support ---
function bg(obj, color) {
	obj.style.backgroundColor = color;
}

function mOver(obj, over){
	bg(obj, over);
	obj.style.cursor = "pointer";
}

function mOut(obj, out){
	bg(obj, out);
}
// --- end mouseover-functions ---


// --- function geturl ---
function getURL(){
	var args = getURL.arguments;
	if (args.length == 1){
		this.location = args[0];
	}else{
		alert("ung?ltige Anzahl an Argumenten beim Aufruf der Funktion \"getURL\"");
		return false;
	}
}

function openwin_printable(imagename,img_width,img_height) {

	var leftpos = (screen.height - img_height)/2;
	var toppos  = (screen.width - img_width)/2;
		
	newWindow = window.open("","newWindow","width="+(img_width+50)+",height="+(img_height+40)+",left="+leftpos+",top="+toppos);
	newWindow.document.open();
	newWindow.document.write('<html><title>Details</title><head><link rel="stylesheet" type="text/css" href="css/styles_content.css"></head><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0">'); 
	newWindow.document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%"><tr><td><table width="1%" border="0" cellspacing="0" cellpadding="1" align="center" valign="top"><tr><td  colspan="2"><img src="'+ imagename + '"></td></tr><tr><td><a href="javascript:self.close();"><b>Fenster schliessen</b></a></td><td><div align="right"><a href="#" onClick="window.print();return false"><b>Anfahrtsplan drucken</b></a></div></td></tr></table></td></tr></table>'); 
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}


// --- js popup function ---
function openwin(img_name,img_width,img_height) {
	if (URLencode) img_name = URLabspath + img_name;

	if (img_width < 30) img_width = 200;
	if (img_height < 30) img_height = 200;

	var leftpos = (screen.height - img_height)/2;
	var toppos  = (screen.width - img_width)/2;
	
	win = window.open("","win","width="+img_width+",height="+img_height+",left="+toppos+",top="+leftpos);
	win.document.open();
	win.document.writeln('<html><title>Detailansicht</title>');
	win.document.writeln('<head>');
	win.document.writeln('<script language="javascript">');
	win.document.writeln('var speed = 10;');
	win.document.writeln('var start_w = 50;');
	win.document.writeln('var start_h = 50;');
	win.document.writeln('window.resizeTo(start_w, start_h);');
	win.document.writeln('var end_w = ' + img_width + ' + 10;');
	win.document.writeln('var end_h = ' + img_height + ' + 29;');
	win.document.writeln('function resize(){');
	win.document.writeln('if(start_w < end_w || start_h < end_h){');
	win.document.writeln('start_w += 10;');
	win.document.writeln('start_h += 10;');
	win.document.writeln('if (start_w > end_w) start_w = end_w;');
	win.document.writeln('if (start_h > end_h) start_h = end_h;')
	win.document.writeln('window.resizeTo(start_w, start_h);');
	win.document.writeln('setTimeout("resize();", 10);');
	//win.document.writeln('alert("w=" + this.start_w + ", " + this.end_w + ", h=" + this.start_h + ", " + this.end_h);');
	win.document.writeln('}');
	win.document.writeln('}');
	win.document.writeln('</script>');
	win.document.writeln('</head>');
	win.document.writeln('<body background="images/popup_loading.gif" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onLoad="resize();">');// onBlur="self.close();">');
	win.document.writeln('<img name="TheImg" src="'+img_name+'" width="'+img_width+'" height="'+img_height+'">'); 
	win.document.writeln('</body></html>');
	win.document.close();
	
	if (!document.layers) { // for IE
		img_width = parseInt(img_width);
		img_height = parseInt(img_height);
		img_width += 10;
		img_height += 29;
	}
	//win.resizeTo(img_width,img_height);
	win.resizeTo(50,50);
	win.focus();
}
