//  Webmanufaktur Standard JS functions

//  Standard Dreamweaver Functions

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//  Opera Resize Fix by P7

function P7_OpResizeFix(a) { //v1.1 by PVII
if(!window.opera){return;}if(!document.p7oprX){
 document.p7oprY=window.innerWidth;document.p7oprX=window.innerHeight;
 document.onmousemove=P7_OpResizeFix;
 }else{if(document.p7oprX){
  var k=document.p7oprX-window.innerHeight;
  var j=document.p7oprY - window.innerWidth;
  if(k>1 || j>1 || k<-1 || j<-1){
  document.p7oprY=window.innerWidth;document.p7oprX=window.innerHeight;
  location.reload();}}}
}
P7_OpResizeFix();


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//  use in onLoad event to define rollover effects

function defineRollover( imgName, imgLosrc, imgHisrc, statusText ) {
  document.images[imgName].losrc = imgLosrc;
  document.images[imgName].hisrc = imgHisrc;
  document.images[imgName].hint  = statusText;
  x = new Image(); x.src = imgHisrc;
}

//  do the rollover effects

function DoRollover( imgName, action) {
  x = document.images[imgName];
  if (x) {
    if (action) {
      if (x.hisrc) x.src = x.hisrc;
      if (x.hint)  window.status = x.hint;
    }
    else {
      if (x.losrc) x.src = x.losrc;
      if (x.hint)  window.status = "";
    }
  }
}

//  get window size

var myWidth = 0, myHeight = 0;

function getWindowSize() {
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else {
    if( document.documentElement &&
        ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
      //IE 6+ in 'standards compliant mode'
      myWidth = document.documentElement.clientWidth;
      myHeight = document.documentElement.clientHeight;
    } else {
      if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
      }
    }
  }
}

// display Picture in Popup Windows

function openPicture(imgName,imgWidth,imgHeight,alt) {
	newWindow = window.open("","histPopup","width="+imgWidth+",height="+imgHeight+",scrollbars=no,menubar=no,status=no");
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onClick="self.close()" onBlur="self.close()">');
	newWindow.document.write('<img src=\"ricola/images/internet/'+imgName+'\" width='+imgWidth+' height='+imgHeight+' alt=\"'+alt+'\">');
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}

// display Flash Movie in Popup Windows

function openFlash(imgName,imgWidth,imgHeight,alt) {
	newWindow = window.open("","histPopup","width="+imgWidth+",height="+imgHeight+",scrollbars=no,menubar=no,status=no");
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" style="margin:0;">');
	newWindow.document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '+
						'	codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,24,0" '+
						'	WIDTH="'+imgWidth+'" '+
						'	HEIGHT="'+imgHeight+'" >'+
						' 	<PARAM NAME=movie VALUE="ricola/media/'+imgName+'">'+
						' 	<PARAM NAME=quality VALUE=high>'+
						'	<PARAM NAME=bgcolor VALUE=#ffffff>'+
						'	<EMBED '+
						'		src="ricola/media/'+imgName+'"'+
						'		quality=high '+
						'		bgcolor=#ffffff  '+
						'		WIDTH="'+imgWidth+'" '+
						'	  HEIGHT="'+imgHeight+'" '+
						'		TYPE="application/x-shockwave-flash" '+
						'		PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">'+
						'	</EMBED>'+
						'</OBJECT>');
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}

// display Flash Banner

function showFlashBanner(swfName,imgWidth,imgHeight) {
    var divId = 777;
	document.write(
		'<div id="flashcontent_'+divId+'" style="width:'+imgWidth+'px height:'+imgHeight+'px">' +
		'  ' +
		'</div>' +
		'<script type="text/javascript">' +
		'	var so = new SWFObject("'+swfName+'", "flash_'+divId+'", "'+imgWidth+'", "'+imgHeight+'", "8", "#FFFFFF");' +
		'	so.write("flashcontent_'+divId+'");' +
		'</script>'
	);
}

// display contact form in popup window

function showContactForm() {
  newWindow = window.open("ric_in_contact.cfm","contactPopup","width=400,height=300,scrollbars=no");
	newWindow.focus();
}

function showContactFormEx() {
  newWindow = window.open("ricola/static/com/contact/ric_in_contact.cfm","contactPopup","width=400,height=500,scrollbars=no");
	newWindow.focus();
}

