var screenW = 640, screenH = 480;
function maxScreenSize()	{
	if (parseInt(navigator.appVersion)>3) {
	 screenW = screen.width;
	 screenH = screen.height;
	}
	else if (navigator.appName == "Netscape" 
		&& parseInt(navigator.appVersion)==3
		&& navigator.javaEnabled()
	   ) 
	{
	 var jToolkit = java.awt.Toolkit.getDefaultToolkit();
	 var jScreenSize = jToolkit.getScreenSize();
	 screenW = jScreenSize.width;
	 screenH = jScreenSize.height;
	}
}
var minWidth = 800, minHeight= 600;
var myWidth = 0, myHeight = 0;
function curScreenSize() {
  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;
  }
}
var w=0, h=0;
function windowSize()	{
	if(!window.innerWidth)	{	//IE
		if(!(document.documentElement.clientWidth == 0))	{//strict mode
			w = document.documentElement.clientWidth;
			h = document.documentElement.clientHeight;
		}
		else	{	//quirks mode
			w = document.body.clientWidth;
			h = document.body.clientHeight;
		}
	}
	else	{		//w3c
		w = window.innerWidth;
		h = window.innerHeight;
	}
}

function showWindowAtribs()	{
	maxScreenSize();
	curScreenSize();
	windowSize();
	document.write("<BR>");
	document.write("Maximum Width:&nbsp;"+screenW+"<BR>");
	document.write("Window Width:&nbsp;"+myWidth+"<BR>");
	document.write("Maximum Height:&nbsp;"+screenH+"<BR>");
	document.write("Window Height:&nbsp;"+myHeight+"<BR>");
	document.write("Element Height:&nbsp;"+h+"<BR>");
	document.write("Element Width:&nbsp;"+w+"<BR>");
	document.write("<BR>");
}
function setBody()	{
	curScreenSize();
	var x=document.getElementById("siteBody");
	if(myHeight <= minHeight)	{
		document.body.style.height = minHeight;
		x.style.height = minHeight - 180;		//172
	}
	else	{
		document.body.style.height = myHeight;
		x.style.height = myHeight - 180;
	}
	if(myWidth <= minWidth)	{
		document.body.style.width = minWidth;
	}
	else	{
		document.body.style.width = myWidth;
	}
}
function setBodySize2(top,leftBox,leftStart,leftWidth,rightBox,rightStart)	{
	var debugThis = 0;
	var maxPageHeight = 650;
	var maxPageWidth = 800;
	var b1=document.getElementById(leftBox);
	var b2=document.getElementById(rightBox);
	var f=document.getElementById('footer');
	maxScreenSize();
	curScreenSize();
	windowSize();
	getBrowserName();
	if(myHeight < maxPageHeight)	{
		setHeight = maxPageHeight;
	}
	else	{
		setHeight = myHeight;
	}
	if(myWidth < maxPageWidth)	{
		setWidth = maxPageWidth;
	}
	else	{
		setWidth = myWidth;
	}
	var width = setWidth - leftWidth - 0;
	b1.style.width = leftWidth;
	b1.style.left = leftStart;
	b1.style.top = top;
	//b1.style.height = "500px";
	if(browserName == "msie")	{
	
	}
	else	{
	
	}
	b2.style.width = width;
	b2.style.left = leftWidth;
	b2.style.top = -390;
	b2.style.height = setHeight - top - 210;
	b2.style.right = 0;
	f.style.width = '100%';
	f.style.left = 0;
	//f.style.top = setHeight - 50;
	//f.style.height = "50px";
	if(debugThis == 1)	{
		document.getElementById('rightBox').innerHTML= "JAVA DEBUG DUMP<BR>";
		document.getElementById('rightBox').innerHTML+="Left side width: "+b1.style.width+"<BR>Left side left: "+b1.style.left+"<BR>";
		document.getElementById('rightBox').innerHTML+="Right side width: "+b2.style.width+"<BR>Right side left: "+b2.style.left+"<BR>";
		document.getElementById('rightBox').innerHTML+="Footer top: "+f.style.top+"<BR>Footer left: "+f.style.left+"<BR>";
		document.getElementById('rightBox').innerHTML+="Current height: "+myHeight+"<BR>";
		document.getElementById('rightBox').innerHTML+="Max height: "+screenH+"<BR>";
		document.getElementById('rightBox').innerHTML+="Current width: "+myWidth+"<BR>";
		document.getElementById('rightBox').innerHTML+="Max width: "+screenW+"<BR>";
		document.getElementById('rightBox').innerHTML+="Your browser app. version: "+navigator.appVersion+"<BR>";
		document.getElementById('rightBox').innerHTML+="Your browser type: "+navigator.appName+"<BR>";
		document.getElementById('rightBox').innerHTML+="Your browser sub-version: "+browserName+"<BR>";
	}
}
function setBodySize(right,left,box1,box2,pctSize)	{
	var debugThis = 0;
	var b1=document.getElementById(box1);
	var b2=document.getElementById(box2);
	maxScreenSize();
	curScreenSize();
	windowSize();
	getBrowserName();
	var thisWidth = myWidth;
	switch(browserName)	{
		case 'safari':
			if(myWidth < 817)	{	//817
				thisWidth = 817;
			}
			break;
		case 'msie':
			if(myWidth < 835)	{	//817
				thisWidth = 835;
			}
			break;
		case 'opera':
			if(myWidth < 835)	{	//817
				thisWidth = 835;
			}
			break;
		case 'firefox':
		case 'netscape':
			if(myWidth < 835)	{	//817
				thisWidth = 835;
			}
			break;
	}
	var width = ((thisWidth-right-left)*pctSize)-25;
	var width2 = ((thisWidth-right-left)*(1-pctSize))-25;
	switch(browserName)	{
		case 'safari':
			width +=8;
			break;
		case 'msie':
			width +=8;
			break;
		case 'opera':
			width -=4;
			break;
		case 'firefox':
		case 'netscape':
		
			break;
	}
	b1.style.width = width - 4;
	b1.style.left = 4;
	b1.style.top = 5;
	b1.style.height = 588;
	b2.style.width = width2 - 4;
	b2.style.left = width + 8;
	b2.style.top = 5;
	b2.style.height = 588;
	b2.style.right = 0;
	if(debugThis == 1)	{
		document.getElementById('register').innerHTML="b1 width: "+b1.style.width+"<BR>b1.left: "+b1.style.left+"<BR>";
		document.getElementById('register').innerHTML+="b2.width: "+b2.style.width+"<BR>b2.left: "+b2.style.left+"<BR>";
		document.getElementById('register').innerHTML+="Browser type: "+navigator.appName+"<BR>";
		document.getElementById('register').innerHTML+="Browser version: "+navigator.appVersion+"<BR>";
		document.getElementById('register').innerHTML+="Current height: "+myHeight+"<BR>";
		document.getElementById('register').innerHTML+="Max height: "+screenH+"<BR>";
		document.getElementById('register').innerHTML+="Current width: "+myWidth+"<BR>";
		document.getElementById('register').innerHTML+="Max width: "+screenW+"<BR>";
		document.getElementById('register').innerHTML+="Browser: "+browserName+"<BR>";
	}
}
var browserName = "none";
function getBrowserName() {
	var ua = navigator.userAgent.toLowerCase();
	if ( ua.indexOf( "opera" ) != -1 ) {
		browserName = "opera";
	} else if ( ua.indexOf( "msie" ) != -1 ) {
		browserName = "msie";
	} else if ( ua.indexOf( "safari" ) != -1 ) {
		browserName = "safari";
	} else if ( ua.indexOf( "mozilla" ) != -1 ) {
		if ( ua.indexOf( "firefox" ) != -1 ) {
			browserName = "firefox";
		} else {
			browserName = "mozilla";
		}
	}
}
function showImage(imageName,locationName)	{
	document.getElementById(locationName).style.backgroundImage="url("+imageName+")";
	document.getElementById(locationName).style.backgroundRepeat="no-repeat";
}
function startRoutine(imageName)	{
	document.getElementById("home").style.backgroundImage="url('"+imageName+"')";
	document.getElementById("home").style.backgroundRepeat="no-repeat";
	document.getElementById("news").style.backgroundImage="url('"+imageName+"')";
	document.getElementById("news").style.backgroundRepeat="no-repeat";
	document.getElementById("forSale").style.backgroundImage="url('"+imageName+"')";
	document.getElementById("forSale").style.backgroundRepeat="no-repeat";
	document.getElementById("photos").style.backgroundImage="url('"+imageName+"')";
	document.getElementById("photos").style.backgroundRepeat="no-repeat";
	document.getElementById("links").style.backgroundImage="url('"+imageName+"')";
	document.getElementById("links").style.backgroundRepeat="no-repeat";
	document.getElementById("contact").style.backgroundImage="url('"+imageName+"')";
	document.getElementById("contact").style.backgroundRepeat="no-repeat";
	document.getElementById("guestbook").style.backgroundImage="url('"+imageName+"')";
	document.getElementById("guestbook").style.backgroundRepeat="no-repeat";
	document.getElementById("aboutUs").style.backgroundImage="url('"+imageName+"')";
	document.getElementById("aboutUs").style.backgroundRepeat="no-repeat";
	document.getElementById("admin").style.backgroundImage="url('"+imageName+"')";
	document.getElementById("admin").style.backgroundRepeat="no-repeat";
}
// var timeout=500,closetimer=0,ddmenuitem=0;
// function mopen(id)	{										// open hidden layer
	// mcancelclosetime();										// cancel close timer
	// if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';	// close old layer
	// ddmenuitem = document.getElementById(id);				// get new layer and show it
	// ddmenuitem.style.visibility = 'visible';	
// }
// function mclose()	{										// close showed layer
	// if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
// }
// function mclosetime()	{									// go close timer
	// closetimer = window.setTimeout(mclose, timeout);
// }
// function mcancelclosetime()	{								// cancel close timer
	// if(closetimer)	{
		// window.clearTimeout(closetimer);
		// closetimer = null;
	// }
// }
// document.onclick = mclose; 									// close layer when click-out
function checkform ( form )	{
	var before = 0;
	var after = 0;
	var dot = 0;
	var dotError = 0;
	var lastDot = 0;
	var from = new String(form.from.value);
	for(var pos = 0; pos < from.length; pos++)	{
		if(from.charAt(pos) == '@')
			++after;
		else	{
			if(after)	{
				++after;
				if(from.charAt(pos) == '.')	{
					if(pos == lastDot + 1)
						++dotError;
					else
						lastDot = pos;
					++dot;
				}
			}
			else
				++before;
		}
		
	}
	if(!form.from.value)	{
		alert( "The email address is missing. Please enter an email address." );
		form.from.focus();
		return false;
	}
	if(!dot || dotError || !before)	{
		alert( "The email address is invalid. Please check your entry." );
		form.from.focus();
		return false;
	}
	if(!form.subject.value)	{
		alert( "There is no subject. Please enter a subject." );
		form.subject.focus();
		return false;
	}
	if(!form.message.value)	{
		alert( "There is no message. Please type a message." );
		form.message.focus();
		return false;
	}
	return true ;
}
var slideimages=new Array()
var slidelinks=new Array()
function slideshowimages(){
for (i=0;i<slideshowimages.arguments.length;i++){
slideimages[i]=new Image()
slideimages[i].src=slideshowimages.arguments[i]
}
}

function slideshowlinks(){
for (i=0;i<slideshowlinks.arguments.length;i++)
slidelinks[i]=slideshowlinks.arguments[i]
}

function gotoshow(){
if (!window.winslide||winslide.closed)
winslide=window.open(slidelinks[whichlink])
else
winslide.location=slidelinks[whichlink]
winslide.focus()
}