function adminPopUp(URL, width, height) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=" + width +",height=" + height +",left = 440,top = 312');");
}
function updateStatus() {
	if(confirm('Would you like to update the status?')){
		document.form1.submit();
	}
}
function updateNotes(type, targetForm) {
	if(type=='blur') {
		if(confirm('Would you like to update the notes?')){
			if(targetForm == "form2"){
				document.form2.submit();
			}else{
				document.form3.submit();
			}
		}
	}else{
		if(targetForm == "form2"){
			document.form2.submit();
		}else{
			document.form3.submit();
		}
	}
}

function printPopUp(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=10,height=10,left = 0,top = 0');");
}
function delete_check(delid, cat_1, cat_2, page){
	if (confirm("Are you sure you want to delete this record?")){
		location.href = page+"?delid="+delid+"&cat_1="+cat_1+"&cat_2="+cat_2;
		return true;
	}else{
		return false;
	}
}
function copyValue(source, target){
	target.selectedindex = source.selectedindex;
}
//Inits for design view...
function Init() { 
 	document.getElementById('iView').contentWindow.document.designMode = "on";
	//document.getElementById('iView').document.body.innerHTML="wertqwerqwer";
  	document.getElementById("iView").contentWindow.focus();
}
function content_init() {
	document.getElementById('iView').contentWindow.document.designMode = "on"; 
	//alert(document.getElementById('story_holder').innerHTML);
	setTimeout("document.getElementById('iView').contentWindow.document.body.innerHTML = document.getElementById('story_holder').innerHTML;",500);
	//alert(document.getElementById('iView').contentWindow.document.body.innerHTML);
	document.getElementById("iView").contentWindow.focus();
}
//-----------
function fixoldformating() {
	s = document.getElementById('story_holder').innerHTML;
	alert(s);
	//document.getElementById('iView').contentWindow.document.body.innerHTML = s.replace('*\n*', '<br />');
	out = "\n"; // replace this
	add = "<br />"; // with this
	temp = "" + s;

	while (temp.indexOf(out)>-1) {
		pos= temp.indexOf(out);
		temp = "" + (temp.substring(0, pos) + add + 
		temp.substring((pos + out.length), temp.length));
	}
	alert(temp);
	document.getElementById('iView').contentWindow.document.body.innerHTML = temp;
}
function preSend() {
	story_content = document.getElementById('iView').contentWindow.document.body.innerHTML;
	document.form1.story.value = story_content;
	//alert(document.form1.story.value);
	document.form1.submit();
}