var win_width = 0;
var win_height = 0;
var neww = null;
if (window.screen.width > 1024) win_width = 1024 - 8; else if(window.screen.width < 800) win_width = 800 - 8;  else win_width = window.screen.width - 8;
if (window.screen.height > 768) win_height = 768 - 52; else if(window.screen.height < 600) win_height = 800-52;  else win_height = window.screen.height - 58;
function submitForm(str) {
	document.all['postpost'].name=str;
	form000x.submit();
}
function openPreview(goodsid, querystring) {
    var popleftgap = 0;
    var poptopgap = 0;
    if (screen.width >= screen.height) {
        if (screen.width <= 1024 || screen.height <= 768) {
            popleftgap = 50;
            poptopgap = 30;
        } else {
            popleftgap = 100;
            poptopgap = 30;
        }
    } else {
        popleftgap = 30;
        poptopgap = 30;
    }
    if (querystring) {
        if (querystring.indexOf("?") < 0) {
            querystring = "?" + querystring;
        }
        window.open('/24/viewer/preview/' + goodsid + querystring, 'yes24preview', 'menubar=no,status=no,toolbar=no,resizable=yes,top=' + poptopgap + ',left=' + popleftgap);
    } else {
        window.open('/24/viewer/preview/' + goodsid, 'yes24preview', 'menubar=no,status=no,toolbar=no,resizable=yes,top=' + poptopgap + ',left=' + popleftgap);
    }
    return false;
}
function ezViewer(URL) {
    var defW = 1024, defH = 768;           
	var OKOK = false;
	if (neww != null) {
		try {
			neww.location.href = URL;
			neww.focus();
			OKOK = true;
		} catch(dd) {
			OKOK = false;
		}
	}
	if (!OKOK) {
		if (window.screen.width > defW && window.screen.height > defH) {
			neww = window.open(URL, 'openInsideWindow', 'scrollbars=no,menubars=no, width=' +(defW)+ ', height=' +(defH)+ ', top=' +parseInt((window.screen.height-defH-27)/2)+ ', left=' +parseInt((window.screen.width-defW-8)/2)   );
		} else {
			neww = window.open(URL, 'openInsideWindow', 'fullscreen,noscrollbars');
		}
	}
}
function OpenBook16(arg_URL) {
  var sUesrState = null;  
  Check_User_Browser();
  Check_User_Moniter();
  gsUesrState = gsUserSize + gsUesrBrowser;
  switch(gsUesrState) {
    case "DefaultMSIE6.0;SP1": 
        Open_TrueeBook_DV60SP1(arg_URL);
      break;
    default:
        Open_TrueeBook_Default(arg_URL);
  }
}
function Open_TrueeBook_LV60SP1(arg_URL) {
    window.open(arg_URL,"LV60SP1","channelmode=no, directories=no, status=no, titlebar=no, toolbar=no, resizable=no, scrollbars=no, menubar=no");
}
function Open_TrueeBook_DV60SP1(arg_URL) {
    window.open(arg_URL,"DV60SP1","fullscreen, scrollbars=no");
}
function Open_TrueeBook_Default(arg_URL) {
    window.open(arg_URL,"Default","fullscreen, scrollbars=no");
}
function Check_User_Browser() {
    var aTempIEV, aTempUpV;
    var sName = "Microsoft Internet Explorer";
    if(window.navigator.appName == sName){
        aTempIEV    = window.navigator.userAgent.split(" ");
        aTempUpV    = window.navigator.appMinorVersion.split(";");
        gsUesrBrowser = aTempIEV[2] + aTempIEV[3] + aTempUpV[1];
    } else {
        alert("TrueeBook will operate more then microsoft internet expolorer 5.0.");
    }
}
function Check_User_Moniter() {
  var sUWidth, sUHeight;
  var sDWidth = 1024;
  var sDHeight = 768;
  
  if((window.screen.width <= sDWidth)&&(window.screen.height <= sDHeight)){gsUserSize = "Default";}
  else{gsUserSize = "Large";}   
}
function Show_StartMessage() {
    var sLang;
    sLang = "en";
    var sCk_Name		=	"StartMessage";
    var sMessageUrl = "http://" + gsServerName + "/engine/help/StartMessage_" + sLang + ".htm";	
    var bCheckStartMessage = Get_CookieVaule(sCk_Name);
    if(bCheckStartMessage != "false") {
        var sCk_Name	 = "StartMessage";
        var sCk_Value = "false";
        var iCk_Expire = 1;
        window.open(sMessageUrl,"StartMessage","channelmode=no, directories=no, status=no, titlebar=no, toolbar=no, resizable=no, scrollbars=no, menubar=no, left=0, top=0, width=240 , height=330");
        Set_CookieVaule(sCk_Name,sCk_Value,iCk_Expire);		
    }
}
function Get_CookieVaule(par_name) {
    var iStart, iEnd
    var iLoopStart = 0;
    var bFoundName = false;
    while (iLoopStart <= document.cookie.length) {
        iStart = iLoopStart; 
        iEnd = iStart + par_name.length;
        if (document.cookie.substring(iStart,iEnd) == par_name) {
            bFoundName = true;
            break;
        }
        iLoopStart ++; 
    }
    if (bFoundName) {
        iStart = iEnd + 1;
        iEnd = document.cookie.indexOf(";",iStart);
        if(iEnd < iStart){iEnd = document.cookie.length;}
        return document.cookie.substring(iStart,iEnd);
    }
    return;
}
function Set_CookieVaule(par_name, par_value, par_epr) {
    var sPath = "/";
    var sDomain = null;
    var dtest = new Date();
    var dExpireDate = new Date();
    dExpireDate.setTime(dExpireDate.getTime() + par_epr*24*60*60*1000);
    var sSetValue = par_name + "=" + par_value + ";" +
                        "expires=" + dExpireDate.toUTCString() + ";" +
                        "path=" + sPath;
    document.cookie = sSetValue;
}	
function SetInit() {
    var oScriptCallTag = document.createElement("Div");
    alert('out');
    Test.appendChild(oScriptCallTag);
    oScriptCallTag.innerHTML = "<table border='1' width='100' ><tr><td>sdf</td><tr></table>";	
}
