// -------------------------------------------------------------------
// IWS - By Brian Lewis, available at: http://www.james117.com
// Created: Aug 4th, 2010
// -------------------------------------------------------------------


function logout() {
    window.location.href = '<%=URL.Add("iws_logout", 1)%>';
}

function iwsDatatypeFileSet(filePath, id) {
    document.getElementById("iwsImage" + id).value = filePath;
}

function iwsDatatypeImageSet(imagePath, id) {
    document.getElementById("iwsImagePath" + id).value = imagePath;
    document.getElementById("iwsImage" + id).src = imagePath;
}
function iwsDatatypeSetRichText(value, id) {
    document.getElementById("iwsRichTextValue" + id).value = value;
    document.getElementById("iwsRichText" + id).innerHTML = value;
}
function iwsDatatypeGetRichText(id) {
    return document.getElementById("iwsRichText" + id).innerHTML;
}
function iwsOpenRTE(id) {
    openPopup('<%=iwsWebsiteManagerPath%>pages/rte/richtext.asp?id=' + id,'iws_rte','no','no','no','no','yes','no','100','100','640','480');
}
function mg_onMouseOver(MyObj, Text, sid) {
	var tmpClassExt = "";

	tmpClassExt = MyObj.className.substring(MyObj.className.lastIndexOf("-"));

	if (tmpClassExt == "-nm") {
		MyObj.className = "WorkareaToolbar-ovr";
	}
	else {
		MyObj.className = "WorkareaToolbar-selectedOver";
	}

    mg_setHeaderText(Text, sid);
}

function mg_onMouseOut(MyObj, sid) {
	var tmpClassExt = "";

	tmpClassExt = MyObj.className.substring(MyObj.className.lastIndexOf("-"));

	if (tmpClassExt == "-ovr") {
		MyObj.className = "WorkareaToolbar-nm";
	}
	else {
		MyObj.className = "WorkareaToolbar-selected";
	}

    mg_restoreHeaderText(sid);
}

function mg_setHeaderText(text, sid) {
    document.getElementById("textarea_" + sid).innerHTML = text;	
}
function mg_restoreHeaderText(sid) {
    document.getElementById("textarea_" + sid).innerHTML = document.getElementById("default_text_" + sid).innerHTML;
}

function mg_confirmDelete(text, url) {
	if (confirm('Are you sure you want to ' + text + '?') == true) {
	    if (url == 'submit form')
	        document.form.submit();
	    else
		    window.location = url;
    }
}
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
function openWindow(url){
    popupWin = window.open(url,'new_page','left=100,top=100,width=400,height=400')
}
function go(url, tool, menu, loc, scroll, resize, status, left, top, width, height) {
    OpenWin = this.open(url, "CtrlWindow", "toolbar=" + tool + ",menubar=" + menu + ",location=" + loc + ",scrollbars=" + scroll + ",resizable=" + resize + ",status=" + status + ",left=" + left + ",top=" + top + ",width=" + width + ",height=" + height);
}
function openPopup(url, windowName, tool, menu, loc, scroll, resize, status, left, top, width, height) {
    OpenWin = this.open(url, windowName, "toolbar=" + tool + ",menubar=" + menu + ",location=" + loc + ",scrollbars=" + scroll + ",resizable=" + resize + ",status=" + status + ",left=" + left + ",top=" + top + ",width=" + width + ",height=" + height);
}
function iwsRefresh() {
    window.location.reload();
}
