﻿/* copyright   RomanticRoad e.K.  all rights reserved.  Title:  Basic JS For All Language Pages.   Main Program executes immediately.   */

var topPos =  0;
var options = "menubar=no,resizeable=no,scrollbars=yes,status=no";
var scrw = 1024;
var pfont = 15;
var dxwin = 620; 
var leftPos = 177;
var winPost = null;
var winTwo = null;
var winThree = null;

/*
function navroll(pgname,linkname,classname,altlabel)
{
	//  basic rollover button with size that adapts to screem and with a navigation link  (i.e., link to a different html page)
 
	//  enter basic (i.e., 1024 screen size)  button image sizes for all rollover navigation buttons:
	var hotelw  = 43;  var hotelh = 25;
	var roomw  = 49;  var roomh = 25;
	var restw  = 79;    var resth = 23;
	var cellarw  = 46;  var cellarh = 36;
	var mapw  = 33;   var maph = 25;
	var homew = 45;  var homeh = 25;
	// select button rollover images based on screen size: 
	var bnpgname = "images/" + pgname + scrw +  ".gif";
	var bnpgnameh = "images/" + pgname +  "h" + 1024 + ".gif"; 
	// compute size:
	if (pgname == "hotel")  { var imgwidth = hotelw; var imgheight = hotelh; };
	if (pgname == "room")  { var imgwidth = roomw; var imgheight = roomh; };
 	if (pgname == "rest")   { var imgwidth = restw; var imgheight = resth; };
	if (pgname == "cellar") { var imgwidth = cellarw; var imgheight = cellarh; };
 	if (pgname == "map")   { var imgwidth = mapw; var imgheight = maph; };
	if (pgname == "home") { var imgwidth = homew; var imgheight = homeh; };
	var imgw = Math.floor(imgwidth  * scrw / 1024);
	var imgh = Math.floor(imgheight * scrw / 1024);
	// write html code: 
	var bnlabel = altlabel;
	var pghtm = linkname; 
	var tagn = pgname + "name";
	if (linkname == "h")
	{
		
		document.write("<p class='nav'><img src='" + bnpgnameh + "'  border='0'   width='"  + imgw + "'   height='"  + imgh + "'   "  +
		" name='" + tagn + "'  alt='" + bnlabel + "'  class='" + classname + "' /></p>"); 
	}
	else
	{
	
	document.write("<p class='nav'><a href='" + pghtm +  "'  onMouseOver='document." + tagn + ".src=\"" + bnpgnameh + "\"'  " + 
	"onMouseOut='document." + tagn + ".src=\"" + bnpgname + "\"'  >" +
	"<img src='" + bnpgname + "'  border='0'   width='"  + imgw + "'   height='"  + imgh + "'  "  +
	" name='" + tagn + "'  alt='" + bnlabel + "'  class='" + classname + "' /></a></p>"); 
	}
}

function randjpg(basename,numimg,imgwidth,imgheight,classname,altlabel)
{
	// select image at random from a set of images & adapt its size to screen size  
	var randnum = Math.ceil(Math.random() * numimg);
	var jpgname = "../images/" + basename +  randnum + ".jpg";
	var imgw = Math.floor(imgwidth * scrw / 1024)
	var imgh = Math.floor(imgheight * scrw / 1024)
	var bnlabel = altlabel;
	var tagname = basename;
	document.write("<img src='" + jpgname + "'  width='" + imgw +  "'  height='" + imgh +  "'  border='0' " +
	"name='" + tagname + "' alt='" + bnlabel + "'  class='" + classname + "' />");
}

function bkmarkroll(imgone,imgtwo,bkmark,imgwidth,imgheight,classname,altlabel)
{
	// rollover button with images that adapt to screen size and with a link to a bookmark
	var pgname = "bk" + bkmark;
	var bnpgname = imgone.src;
	var bnpgnameh = imgtwo.src; 
	var imgw = Math.floor(imgwidth * scrw / 1024)
	var imgh = Math.floor(imgheight * scrw / 1024)
	var pghtm = "#" + bkmark; 
	var bnlabel = altlabel;
	document.write("<a href='" + pghtm +  "'  onMouseOver='document." + pgname + ".src=\"" + bnpgnameh + "\"'" + 
	"onMouseOut='document." + pgname + ".src=\"" + bnpgname + "\"'  >" +
	"<img src='" + bnpgname + "'  width='" + imgw + "' height='" + imgh + "' border='0' " +
	"name='" + pgname + "' alt='" + bnlabel + "'  class='" + classname + "' /></a>"); 
}
*/


function popWin(url)
{
	closeTwo();
	winTwo = window.open(url,"Menu","width=" + dxwin + ",height=" + dywin + ",left=" + leftPos + ",top=" + topPos + options); 
}



function closeTwo()
{
	if ((winTwo) && (!winTwo.closed))
	{
		winTwo.close();
	}
}

function closeThree()
{
	if ((winThree) && (!winThree.closed))
	{
		winThree.close();
	}
}

/*  Manage  Images  With JS  */

function adaptImg(pathname,imgwidth,imgheight,classname)
{
	// var jpgname = "../images/" + pgname + ".jpg";
	var imgw = Math.floor(imgwidth * scrw / 1024)
	var imgh = Math.floor(imgheight * scrw / 1024)
	document.write("<img src='" + pathname + "'  width='" + imgw + "' height='" + imgh + "' border='0'  class='" + classname + "' />");
}

function imggif(filepath,imgwidth,imgheight,classname)
{
	var imgw = Math.floor(imgwidth * scrw / 1024)
	var imgh = Math.floor(imgheight * scrw / 1024)
	var gifname = filepath + scrw + ".gif";
	document.write("<img src='" + gifname + "'    width='" + imgw + "'    height='" + imgh + "'  border='0'   class='" + classname + "' />");

}

function imgglass(imgwidth,imgheight)
{
	var gifname = "../images/glass.gif";
	var imgw = Math.floor(imgwidth * scrw / 1024)
	var imgh = Math.floor(imgheight * scrw / 1024)
	document.write("<img src='" + gifname + "'  width='" + imgw + "' height='" + imgh + "' border='0'  />");
}

/*  Manage Tags with Style   */

function chgstyleID(idname,xpos, ypos)
{
	var posx =  Math.floor(xpos * scrw / 1024);
	var posy =  Math.floor(ypos * scrw / 1024);
	document.write("<style type='text/css'>#" + idname + " {position: absolute; top:" + posy + "px;  left:" + posx + "px;}</style>");  
} 

function adaptAbsPos(tagdotclass,tagleft,tagtop)
{
	var tagl = Math.floor(tagleft  * scrw / 1024);
	var tagt = Math.floor(tagtop  * scrw / 1024);
	document.write("<style type='text/css'>" + tagdotclass +  "{position: absolute;}</style>");    
	document.write("<style type='text/css'>" + tagdotclass +  "{left:" + tagl + "px;}</style>");    
	document.write("<style type='text/css'>" + tagdotclass +  "{top:" + tagt + "px;}</style>");    
}	

function adaptTxtTag(tagdotclass,txtwidth,dfontsz)
{
	var paraw =  Math.floor(txtwidth * scrw / 1024);
	var fontsz = pfont + dfontsz;
	document.write("<style type='text/css'>" + tagdotclass +  "{font-size:" + fontsz + "px;}</style>");  
	document.write("<style type='text/css'>" + tagdotclass +  "{width:" + paraw + "px;}</style>");      
}

function adaptTxtSize(tagdotclass,dfontsz)
{
	var fontsz = pfont + dfontsz;
	document.write("<style type='text/css'>" + tagdotclass +  "{font-size:" + fontsz + "px;}</style>");  
}


function adaptWidth(tagdotclass,tagwidth)
{
	var tagw = Math.floor(tagwidth  * scrw / 1024);
	document.write("<style type='text/css'>" + tagdotclass +  " {width:" + tagw + "px;}</style>");    
}

function adaptSize(tagdotclass,tagwidth,tagheight)
{
	var tagw = Math.floor(tagwidth  * scrw / 1024);
	var tagh = Math.floor(tagheight  * scrw / 1024);
	document.write("<style type='text/css'>" + tagdotclass +  "{width:" + tagw + "px;}</style>");    
	document.write("<style type='text/css'>" + tagdotclass +  "{height:" + tagh + "px;}</style>");    
}

function adaptBG(tagdotclass,bgfilename)
{
	var imgbg =  bgfilename;
	document.write("<style type='text/css'>" + tagdotclass + "  {background-image:url(" + imgbg + ");}</style>");    
}

function adaptPos(tagdotclass,tagleft,tagtop)
{
	var tagl = Math.floor(tagleft  * scrw / 1024);
	var tagt = Math.floor(tagtop  * scrw / 1024);
	document.write("<style type='text/css'>" + tagdotclass +  " {left:" + tagl + "px;}</style>");    
	document.write("<style type='text/css'>" + tagdotclass +  " {top:" + tagt + "px;}</style>");    
}

/*  Main Program Code  */ 

var dxscreen = screen.width;
var dyscreen = screen.height;
var dywin = dyscreen - 55;

	if ( dxscreen < 950 )
	{
		scrw = 800;
		pfont = 11;
		dxwin = 484; 
	}
	else
	{
		if ( dxscreen <  1100 )
		{
			scrw = 1024;
			pfont = 15;
			dxwin = 620; 
		}
		else
		{	
			if ( dxscreen < 1250 )
			{
				scrw = 1152;
				pfont = 17;
				dxwin = 698; 
			}
			else
			{
				scrw = 1280;
				pfont = 18;
				dxwin = 775; 
				if (dyscreen < 950)
				{
					scrw = 1152;
					pfont = 17;
					dxwin = 698; 
				}
				if (dyscreen < 850)
				{
					scrw = 1024;
					pfont = 15;
					dxwin = 620; 
				}
			}
		}
	}

dxwinex = Math.floor( 1.3 * dxwin);
leftPos =  (scrw / 2) - (dxwinex / 2 + 15) + (dxscreen -scrw);

/* End Main  */
