var sURL = "media.intechfurniture.com";
var sImageURL = "www.intechfurniture.com";
function popup(parent, src, width, height)
{
	parent.setAttribute('href','javascript:void(0);');
	parent.setAttribute('target','');
	var win = window.open('/assets/file/index.php?GetFile='+src,null,"height="+height+",width="+width+",status=no,left=112, top=84,toolbar=no,menubar=no,location=no");
}

var timerID;
var bRichText = false;

function show(menu, top)
{
alert(top);
	clearTimeout(timerID);
	timerID = setTimeout("hide('" + menu + "')", 1000);
	document.getElementById(menu).style.top = top;
	//document.getElementById(menu).style.left = '160';
	document.getElementById(menu).style.display = 'inline';

}


function hide(menu)
{
	document.getElementById(menu).style.display = 'none';
}


function editor_init()
{
	document.frames.editor.document.designMode = "On";
}

function editor_cmd(cmd)
{
	if(cmd == "init")
	{
		if(!bRichText) 
		{
			editor_init();
			frames.editor.document.body.innerHTML = document.getElementById("default[long_text]").value;
			var hidden = document.getElementById('default[long_text]');
			hidden.style.display = "none";

			var frame = document.getElementById('editor');
			frame.style.display = "block";
			bRichText = true;

			var button = document.getElementById('init');
			button.value = "View Source...";
		}
		else
		{
			document.getElementById("default[long_text]").value = frames.editor.document.body.innerHTML;
			var hidden = document.getElementById('default[long_text]');
			hidden.style.display = "block";

			var frame = document.getElementById('editor');
			frame.style.display = "none";
			bRichText = false;

			var button = document.getElementById('init');
			button.value = "Rich Text...";
		}
	}
	else
	{
		if(cmd == "heading")
		{
			var select = document.getElementById('heading');
//			switch(heading)
//			{
//				case "Paragraph";
//			}
//			frames.editor.document.execCommand(cmd);
		}
		else
		{
			frames.editor.document.execCommand(cmd);
		}
	}
}



function editor_save()
{
	if(!bRichText) 
	{

	}
	else
	{
		var hidden = document.getElementById('default[long_text]');
		hidden.value = (frames.editor.document.body.innerHTML);
	}

}

function drawFlashMovie(movieWidth, movieHeight, movieName, movieBase, bgColor){
	var so = new SWFObject(movieName, "flash", movieWidth, movieHeight, "8", bgColor);
	so.addParam("quality", "high");
	so.addParam("base", movieBase);
	so.useExpressInstall('http://www.intechfurniture.com/assets/script/expressinstall.swf');
	so.write("flashcontent");
}

var movieWin = null;
function viewTour(tour, width, height){

	if(movieWin!=null){
		movieWin.close();
	}
	var left;
	var top;
	left = (screen.width - width) / 2;
	top = (screen.height - height) / 2;
	var args = "width=" + width + ",height=" + height + ",left=" + left + ",top=" + top;
	
	movieWin = window.open("http://" + sURL + "/" + tour + ".html", "Movie", args);
}

var imageWindow = null;
function loadImage(folderName, imgName, width, height){
	var left;
	var top;
	left = (screen.width - width) / 2;
	top = (screen.height - height) / 2;
	var args = "width=" + width + ",height=" + height + ",left=" + left + ",top=" + top;
	imageWindow = window.open("", "Intech", args);
	url = "http://" + sImageURL + "/assets/library/assets/images/" + folderName + "/lrg/" + imgName;
	imageWindow.document.open();
	imageWindow.document.write('<style>body{margin:0px;padding:0px}</style>');
	imageWindow.document.write('<img src="' + url + '" />');
	imageWindow.document.close();

}
