//===========================
function OpenTicketForm() {
Open_WINDOW("/LiveEE/IENHelpdesk.nsf/TicketIEN?OpenForm&login","","",800)
}
//===========================
function OpenKB() {
Open_WINDOW("/LiveEE/IENHelpdesk.nsf?Open&login","")
}
//===========================open a new window
function Open_WINDOW(URL,Name,H,W,SCROLL) {
var WIN;
WIN = Open_WINDOW_Server2(URL,Name,H,W,SCROLL);
return WIN;
}
//===========================open a new window with url from another server
function Open_WINDOW_Server2(URL,Name,H,W,SCROLL) {
//Name = "_blank";
var WIN;
if (typeof(H) == "undefined" || H == "") H = screen.height - 55;
if (typeof(W) == "undefined" || W == "") W = screen.width;
WS = screen.width / 2;
WH = screen.height / 2;
H-=20;
if (SCROLL != "No")
WIN = window.open("",Name,"height=" + H + ",width=" + W + ",scrollbars,resizable,status");
else
WIN = window.open("",Name,"height=" + H + ",width=" + W + ", status");
var LEFT, RIGHT;
LEFT = (WS - W/2) - 5;
TOP = (WH - H/2) - 38;
WIN.moveTo(LEFT,TOP);
WIN.location.href = URL;
WIN.focus();
return WIN;
}
//===========================
function ShowRegistration(Type , CLOSE_BTN , SelectType , EventName , HeadingText , EmailText , LinkType , Industry , Campaign , Tactic , Country) {
var URL = "/LiveEE/IENWeb.nsf/Registration-Small?OpenForm";
if (CLOSE_BTN != "No") URL = URL + "&AllowClose=1";
if (typeof(Type)!="undefined" && Type != "") URL = URL + "&Type=" + Type;
if (typeof(SelectType)!="undefined" && SelectType != "") URL = URL + "&SelectType=" + SelectType;
if (typeof(EventName)!="undefined" && EventName != "") URL = URL + "&EventName=" + EventName;
if (typeof(HeadingText)!="undefined" && HeadingText != "") URL = URL + "&HeadingText=" + HeadingText;
if (typeof(EmailText)!="undefined" && EmailText != "") URL = URL + "&EmailText=" + EmailText;
if (typeof(LinkType)!="undefined" && LinkType != "") URL = URL + "&LinkType=" + LinkType;
if (typeof(Industry)!="undefined" && Industry != "") URL = URL + "&Industry=" + Industry;
if (typeof(Campaign)!="undefined" && Campaign != "") URL = URL + "&Campaign=" + Campaign;
if (typeof(Tactic)!="undefined" && Tactic != "") URL = URL + "&Tactic=" + Tactic;
if (typeof(Country)!="undefined" && Country != "") URL = URL + "&Country=" + Country;
Open_DHTML_WINDOW(URL,"",640,460,"No","",CLOSE_BTN);
}
function OpenDemoAfterRegistration() {
window.open("http://empower01.ienterprises.com/empowercrmpublicdemo");
}
//##########========================================================DHTML WINDOW
var CURRENT_WINDOW_DIV = "";
var JS_TO_RUN_ON_DHTML_WIN_ClOSE = "";
var PAGE_COVER_DONE;
function Draw_DHTMLWindowFrames(arg) {
var win_DHTML = "
";
document.write(win_DHTML);
PAGE_COVER_DONE = 1;
}
//In views we are calling this funtion inside the page
var Draw_Frames = 1;
if (typeof(IS_WEB_VIEW) == "number") if (IS_WEB_VIEW) Draw_Frames = 0;
if (Draw_Frames && PAGE_COVER_DONE != 1) Draw_DHTMLWindowFrames();
//===========================open a new dhtml window with a url
function Open_DHTML_WINDOW(URL,Name,H,W,SCROLL,TOP_BAR,CLOSE_BTN) {
JS_TO_RUN_ON_DHTML_WIN_ClOSE = "";
try {
var FIT_Height = get_div_fit_height ();
if (!(IE)) FIT_Height = FIT_Height - 5;
var FIT_Width = get_div_fit_width ();
if (!(IE)) FIT_Width = FIT_Width + 8;
document.getElementById('page_cover_div').style.height = FIT_Height;
document.getElementById('page_cover_div').style.width = FIT_Width;
var winH;
var winW;
var wTop;
if (typeof(H) == "undefined" || H == "" || H == 0) {
H = 0;
winH = FIT_Height;
wTop = 0;
}
else {
H = parseInt(H);
if (IE) winH = H+30;
else winH = H+20;
if (TOP_BAR == "No") winH = winH - 25;
wTop = (document.body.clientHeight/2) + document.body.scrollTop - (winH/2);
if (wTop > 100) wTop = wTop - 50;
if (wTop < 0) wTop = 0;
if (winH > FIT_Height) winH = FIT_Height;
}
if (typeof(W) == "undefined" || W == "" || W == 0) {
W = 0;
winW = "100%";
}
else {
W = parseInt(W);
if (IE) winW = W+10;
else winW = W+30;
}
CURRENT_WINDOW_DIV = "dhtml_win_content";
setdiv('page_cover_div').height = FIT_Height;
setdiv('page_cover_div').display="block";
setdiv(CURRENT_WINDOW_DIV).top=wTop+"px";
setdiv(CURRENT_WINDOW_DIV).display="block";
var borderT = 1;
var borderR = 2;
var borderB = 2;
var borderL = 1;
if (typeof(H) == "undefined" || H == "") {
borderT = 0;
borderB = 0;
}
if (typeof(W) == "undefined" || W == "") {
borderR = 0;
borderL = 0;
}
var win_border = borderT+" "+borderR+" "+borderB+" "+borderL;
var win_HTML = ""+
""+
""+
" ";
if (TOP_BAR != "No") {
win_HTML = win_HTML + "| "+ DHTML_WINDOW_TOP_BAR("",SCROLL,CLOSE_BTN) + " | "+
" | "
}
var htmlSCROLL = "";
if (SCROLL == "No") htmlSCROLL = "scrolling=no";
win_HTML = win_HTML + ""+
"| "+
""+
" | "+
" "+
" "+
" "+
" |
"+
"
";
WINDOW_RESIZE_SCRIPT = "ReSet_Position("+H+","+W+",\""+TOP_BAR+"\")";
WriteDiv(CURRENT_WINDOW_DIV , win_HTML);
}
catch(err) {
alert("iExtensions->ERROR.");
return true;
}
}
//===========================adjust the position on window resize
function ReSet_Position(H , W , TOP_BAR) {
var FIT_Height = get_div_fit_height ();
if (!(IE)) FIT_Height = FIT_Height - 5;
var FIT_Width = get_div_fit_width ();
if (!(IE)) FIT_Width = FIT_Width + 8;
document.getElementById('page_cover_div').style.height = FIT_Height;
document.getElementById('page_cover_div').style.width = FIT_Width;
var winH;
var winW;
var wTop;
if (typeof(H) == "undefined" || H == "" || H == 0) {
H = 0;
winH = FIT_Height;
wTop = 0;
}
else {
H = parseInt(H);
if (IE) winH = H+30;
else winH = H+20;
if (TOP_BAR == "No") winH = winH - 25;
wTop = (document.body.clientHeight/2) + document.body.scrollTop - (winH/2);
if (wTop > 100) wTop = wTop - 50;
if (wTop < 0) wTop = 0;
if (winH > FIT_Height) winH = FIT_Height;
}
if (typeof(W) == "undefined" || W == "" || W == 0) {
W = 0;
winW = "100%";
}
else {
W = parseInt(W);
if (IE) winW = W+10;
else winW = W+30;
}
document.getElementById(CURRENT_WINDOW_DIV).style.top=wTop+"px";
document.getElementById("DHTML_WINDOW_TABLE").style.width=winW;
document.getElementById("DHTML_WINDOW_TABLE").style.height=winH;
}
//===========================show cover
function Show_PageCover() {
var FIT_Height = get_div_fit_height ();
setdiv('page_cover_div').height = FIT_Height;
setdiv('page_cover_div').display="block";
}
//===========================dhtml window top bar title
function SetiFrameWindow() {
try {
setdivA('DHTML_WINDOW_TOP_BAR_TITLE').innerHTML = frames['DHTML_WINDOW_IFRAME'].document.title;
}
catch (err) {
try {setdivA('DHTML_WINDOW_TOP_BAR_TITLE').innerHTML = frames[0].document.title;}
catch (err) {}
}
}
//===========================dhtml window - unload
function UnloadiFrameWindow() {
try {
frames['DHTML_WINDOW_IFRAME'].location.href = "about:blank";
}
catch (err) {
try {frames[0].location.href = "about:blank";}
catch (err) {}
}
}
//===========================open a new dhtml window with a div
function Open_DHTML_DIV_WINDOW(DivName , PageCover) {
try {
if (typeof(PageCover) == "undefined") PageCover = "";
var FIT_Height = get_div_fit_height ();
if (!(IE)) FIT_Height = FIT_Height - 5;
var FIT_Width = get_div_fit_width ();
if (!(IE)) FIT_Width = FIT_Width + 8;
CURRENT_WINDOW_DIV = DivName;
if (PageCover != "No") {
document.getElementById('page_cover_div').style.height = FIT_Height;
if (!IE) document.getElementById('page_cover_div').style.width = FIT_Width;
document.getElementById('page_cover_div').style.left = 5;
document.getElementById('page_cover_div').style.display="block";
}
setdiv(CURRENT_WINDOW_DIV).top = document.body.scrollTop + 30;
setdiv(CURRENT_WINDOW_DIV).display="block";
}
catch(err) {
alert("iExtensions->ERROR2.");
return true;
}
}
//===========================dhtml window top bar
function DHTML_WINDOW_TOP_BAR(Label,SCROLL,CLOSEBTN) {
var win_HTML = ""+
""+
""+
""+Label+" | ";
if (CLOSEBTN != "No") win_HTML = win_HTML + " | ";
win_HTML = win_HTML + " "+
" |
"+
"
";
return win_HTML;
}
//===========================
function get_div_fit_height(){
var y;
var test1 = document.body.scrollHeight;
var test2 = document.body.offsetHeight;
if (typeof(test1)=="undefined") test1 = window.innerHeight;
if (typeof(test2)=="undefined") test2 = document.body.clientHeight;
if (test1 > test2) y = test1;
else y = test2;
if (parent.frames.length <= 1) y = y - 5;
if (!(IE)) y = y - 8;
return y;
}
//===========================
function get_div_fit_width(){
var y;
var test1 = document.body.scrollWidth;
var test2 = document.body.offsetWidth;
if (typeof(test1)=="undefined") test1 = window.innerWidth;
if (typeof(test2)=="undefined") test2 = document.body.clientWidth;
if (test1 > test2) y = test1;
else y = test2;
if (parent.frames.length <= 1) y = y - 5;
if (!(IE)) y = y - 8;
return y;
}
//===========================
var is_DHTML_WIN = false;
try {
if (parent.frames.length > 0 && typeof(parent.setdivA('DHTML_WINDOW_IFRAME')) != "undefined") is_DHTML_WIN = true;
}
catch(err) {
is_DHTML_WIN = false;
}
//===========================close dhtml window
function Close_DHTML_WINDOW() {
UnloadiFrameWindow();
document.getElementById(CURRENT_WINDOW_DIV).style.display="none";
document.getElementById('page_cover_div').style.display="none";
WINDOW_RESIZE_SCRIPT = "";
if (JS_TO_RUN_ON_DHTML_WIN_ClOSE != "") { //to run some javascript on dhtml window close
eval(JS_TO_RUN_ON_DHTML_WIN_ClOSE)
}
}
//===========================close window
function Close_WINDOW() {
if (is_DHTML_WIN) GetParentWINDOW().Close_DHTML_WINDOW();
else {
try {
if (window.parent.frames) {window.parent.opener = top;window.parent.close();}
else {window.opener = top;window.close();}
}
catch (err) {window.opener = top;window.close();}
}
}
//===========================get parent window
function GetParentWINDOW() {
if (is_DHTML_WIN) return window.parent;
else return window.opener;
}
//##########========================================================END DHTML WINDOW
//===========================TRIM / LTRIM / RTRIM strings
function LTRIM(STR) {
STR = STR.toString();
return STR.replace( /^\s*/, "" )
}
function RTRIM(STR) {
STR = STR.toString();
return STR.replace( /\s*$/, "" );
}
function TRIM(STR) {
STR = STR.toString();
return RTRIM(LTRIM(STR));
}
//=========================== Replace a substring from a string with another
function ReplaceChar(STR,Char1,Char2) {
var replacepatern = eval("/" + Char1 + "/g");
return STR.replace(replacepatern , Char2);
}
//=========================== to change a query string value of a url
function ChangeURL_qsValue(URL , qsLabel , qsValue) {
var L = URL.length;
var qsToPass = qsLabel + qsValue;
var qsExists = URL.indexOf(qsLabel);
if (qsExists == -1) {
var N = URL.indexOf("&");
var URL1 = URL.substring(0 , N);
var URL_Last = URL.substring(N , L);
}
else {
var N = qsExists;
var URL1 = URL.substring(0 , N);
var URL2 = URL.substring(N+1 , L);
var L2 = URL2.length;
var N2;
//special for category - to allow "&" in category string
if (qsLabel == "&CAT=") {N2 = URL2.indexOf("&VIEW=");if (N2 == -1) N2 = URL2.indexOf("&");}
else if (qsLabel == "&CAT2=") {N2 = URL2.indexOf("&CAT=");if (N2 == -1) N2 = URL2.indexOf("&");}
else N2 = URL2.indexOf("&");
var URL_Last;
if (N2 == -1) URL_Last = "";
else URL_Last = URL2.substring(N2 , L2);
}
if (URL1 == "") URL = URL_Last + qsToPass;
else URL = URL1 + qsToPass + URL_Last;
return URL;
}
//===========================set cookie
function setCookie(NameOfCookie, value, expirehours) {
if (typeof(expirehours) == "undefined") expirehours = 8760;
var ExpireDate = new Date ();
ExpireDate.setTime(ExpireDate.getTime() + (expirehours * 3600 * 1000));
document.cookie = NameOfCookie + "=" + escape(value) + ((expirehours == null) ? "" : "; expires=" + ExpireDate.toGMTString()) + "; path=/;" ;
}
//===========================set cookie
function getCookie(NameOfCookie) {
var bikky = document.cookie;
var index = bikky.indexOf(NameOfCookie + "=");
if (index == -1) return null;
index = bikky.indexOf("=", index) + 1; // first character
var endstr = bikky.indexOf(";", index);
if (endstr == -1) endstr = bikky.length; // last character
return unescape(bikky.substring(index, endstr));
}
//==========================Browser Detect
var Browser = navigator.userAgent.toLowerCase()
var IE;
var Mozilla;
var OtherBrowser;
if (Browser.indexOf("msie") > -1) IE = true;
else if (Browser.indexOf("mozilla") > -1) Mozilla = true
else OtherBrowser = true;
//===========================
//Write to Layer for IE and Netscape..
function WriteDiv(arg,T) {
var D;
if (document.all) {D = eval("document.all." + arg);}
else if (document.layers) {D = eval("document.layers." + arg);}
else {D = document.getElementById(arg);}
D.innerHTML = T;
}
//Setting Layer for IE and Netscape..
function setdiv(arg) {
if (document.all) {return eval("document.all." + arg + ".style");}
else if (document.layers) {return eval("document.layers." + arg);}
else {return document.getElementById(arg).style;}
}
//Setting Layer for IE and Netscape..
function setdivA(arg) {
if (document.all) {return eval("document.all." + arg);}
else if (document.layers) {return eval("document.layers." + arg);}
else {return document.getElementById(arg);}
}
//Getting Elements By ID
function getElement(arg) {
if (document.all) {return eval("document.all." + arg);}
else if (document.layers) {return eval("document." + arg);}
else {return document.getElementById(arg);}
}