//-------------------------------------------------------------------------------------
//Break out of frame if necessary
if (top.frames.length!=0) {
	if (window.location.href.replace)
		top.location.replace(self.location.href);
	else
		top.location.href=self.document.href;
}

//-------------------------------------------------------------------------------------
//Popup
function popup(url, name, height, width, scrollbars) {
	var popwin;
	var opts = "toolbar=no,status=yes,location=no,menubar=no,resizable=yes";
	opts += ",height=" + height + ",width=" + width + ",scrollbars=" + scrollbars;
	popwin = window.open("", name, opts);
	popwin.focus();
	popwin.location = url;
}

//-------------------------------------------------------------------------------------
//Cross-Browser Bookmark
function addbookmark() {
   bookmarkurl="http://www.guentherhomes.com/"
   bookmarktitle="Guenther Homes"
   if (document.all)
   window.external.AddFavorite(bookmarkurl,bookmarktitle)
}

//-------------------------------------------------------------------------------------
//Visibility Toggle
function switchMenu(obj) {
	var el = document.getElementById(obj);
	if (el.style.display!="none") 
		el.style.display='none';
	else 
		el.style.display = '';
}

//-------------------------------------------------------------------------------------
//Image popup

function viewPic(img) { 	
	picfile = new Image(); 
	picfile.src =(img); 
	fileCheck(img); 
}

function fileCheck(img) { 	
	if( (picfile.width!=0) && (picfile.height!=0) ) { 
		makeWindow(img); 
	} else {
		funzione="fileCheck('"+img+"')"; 
		intervallo=setTimeout(funzione,50); 
	}
}
	
function makeWindow(img) { 	
	ht = picfile.height + 20;
	wd = picfile.width + 20; 
	var args= "height=" + ht + ",innerHeight=" + ht;
	args += ",width=" + wd + ",innerWidth=" + wd;
	if (window.screen) { 
		var avht = screen.availHeight; 
		var avwd = screen.availWidth;
		var xcen = (avwd - wd) / 2; 
		var ycen = (avht - ht) / 2;
		args += ",left=" + xcen + ",screenX=" + xcen;
		args += ",top=" + ycen + ",screenY=" + ycen + ",resizable=yes"; 	
	}
	return window.open(img, '', args); 
} 
