var MM_contentVersion = 6;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if (plugin) {
	var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	   for (var i = 0; i < words.length; ++i) {
			if (isNaN(parseInt(words[i]))) continue;
			var MM_PluginVersion = words[i]; 
	   }
	var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
} else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0  && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
	document.write('on error resume next \n');
	document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
	document.write('</SCR' + 'IPT\> \n');
}
function genCube(obj) {
	if (MM_FlashCanPlay) {
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
		document.write(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"');
		document.write(' id="photo_cube" width="300" height="300" align="">');
		document.write('<param name=movie value="photo_cube.swf?colorset='+obj+'"><param name=loop value=false><param name=menu value=false><param name=quality value=best><param name=scale value=exactfit><param name=bgcolor value=#ffffff>');
		document.write('<embed src="photo_cube.swf?colorset='+obj+'" loop=false menu=false quality=best scale=exactfit bgcolor=#ffffff');
		document.write(' swLiveConnect=false width="300" height="300" name="photo_cube" align=""');
		document.write(' TYPE="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">');
		document.write('</embed>');
		document.write('</object>');
	} else document.write('You need latest version of <a rel="external" href="http://www.macromedia.com/go/getflashplayer/">Flash</a> to view this page.');
}
function externalLinks() { 
	if (!document.getElementsByTagName) return; 
	var anchors = document.getElementsByTagName("a"); 
	for (var i=0; i<anchors.length; i++) { 
		var anchor = anchors[i]; 
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") anchor.target = "_blank"; 
	} 
} 
window.onload = externalLinks;
function isEmpty(obj) {if((obj.replace(/ /g,"")).replace(/\r\n/g,"")=="")return true;else return false;}
function genemail(user,domain,suffix){document.write('<a href="'+'mailto:'+user+'@'+domain+'.'+suffix+'">'+user+'@'+domain+'.'+suffix+'</a>');}
function genemail2(user,domain,suffix,text){document.write('<a href="'+'mailto:'+user+'@'+domain+'.'+suffix+'">'+text+'</a>');}
function txtCt(obj,maxlimit){if(obj.value.length>maxlimit)obj.value=obj.value.substring(0,maxlimit);}
var imgexts=new Array("jpg","gif","jpeg","png");
var emailExp = /^([a-zA-Z0-9._-]+)@([a-zA-Z0-9-])+(\.[a-zA-Z0-9-]+)+$/;
var zipExp = /\d{5}$/;

function newwin(path,winname,height,width) {
	leftpos = screen.width/2-width/2;toppos = screen.height/2-height/2;
	if (navigator.userAgent.toLowerCase().search(/safari/g) != -1) { width=width-2;height--; }
	preview = window.open(path, winname, "width="+width+",height="+height+",left="+leftpos+",top="+toppos+",toolbar=no,status=no,scrollbars=no,resizable=no");
	preview.focus();
}
function setupIframe(obj) {
	frames.main.document.designMode = 'Off';
	frames.main.document.designMode = 'On';
	main.document.write('<html><head><title>Dietz</title><link rel="stylesheet" href="/jsscripts/fonts.css" type="text/css"/></head><body>'+obj+'</body></html>');
	main.focus();
}
function editMain(obj) {
    tr = main.document.selection.createRange();
	tr.execCommand(obj);
    tr.select();
    main.focus();
}
var format = "HTML";
function swapModes() {
	if (format == "HTML") {
		main.document.body.innerText = main.document.body.innerHTML;
		document.getElementById("source").value = "HTML";
		format = "Text";
 	} else {
		main.document.body.innerHTML = main.document.body.innerText;
		document.getElementById("source").value = "Source";
		format = "HTML";
	}
	main.focus();
}
function addImg() {
	main.focus();
	with (document.getElementById("editpg")) {
		imgsrc = dbimgs[dbimgs.selectedIndex].value; if (isEmpty(imgsrc)) return;
		imgpos = dbimgpos[dbimgpos.selectedIndex].value;
		dbimgs.selectedIndex = dbimgpos.selectedIndex = 0;
	}
	tr = main.document.selection.createRange();
	frames.main.document.execCommand("paste", true, "img");
	tr.findText("img");
	tr.pasteHTML("<img src='/codebase/functions/genimage.asp?img="+imgsrc+"'"+imgpos+">");
}