var isMozilla;
var objDiv = null;
var originalDivHTML = "";
var DivID = "";
var over = false;
// dinamically add a div to
// dim all the page
function buildDimmerDiv(){
document.write('
');
}//End of function buildDimmerDiv
function displayFloatingDiv(divId, title, width, height, left, top) {
DivID = divId;
document.getElementById('dimmer').style.visibility = "visible";
document.getElementById(divId).style.display = "block";
document.getElementById(divId).style.width = width + 'px';
document.getElementById(divId).style.height = height + 'px';
$(document.getElementById(divId)).find('iframe').show();
document.getElementById(divId).style.left = left + 'px';
document.getElementById(divId).style.top = top + 'px';
var addHeader;
if (originalDivHTML == "")
originalDivHTML = document.getElementById(divId).innerHTML;
addHeader = '';
// add to your div an header
document.getElementById(divId).innerHTML = addHeader + originalDivHTML;
if (document.getElementById(divId).className) {
document.getElementById(divId).className = document.getElementById(divId).className + ' dimming';
}
else {
document.getElementById(divId).className = 'dimming';
}
document.getElementById(divId).style.visibility = "visible";
}//End of function displayFloatingDiv
function allowOnlyOnePopup(divId) {
followPopup_Top_Obj = document.getElementById('windowfollowcontenttop');
followPopup_Bottom_Obj = document.getElementById('windowfollowcontentbutton');
emailPopup_Top_Obj = document.getElementById('windowcontenttop');
emailPopup_Bottom_Obj = document.getElementById('windowcontentbutton');
if (divId == 'windowfollowcontenttop') { //follow top
if (followPopup_Bottom_Obj && followPopup_Bottom_Obj != 'undefined')
hiddenArticleToolbarFloatingDiv('windowfollowcontentbutton');
if (emailPopup_Top_Obj && emailPopup_Top_Obj != 'undefined')
hiddenArticleToolbarFloatingDiv('windowcontenttop');
if (emailPopup_Bottom_Obj && emailPopup_Bottom_Obj != 'undefined')
hiddenArticleToolbarFloatingDiv('windowcontentbutton');
}
else if (divId == 'windowcontenttop') { //Email top
if (followPopup_Bottom_Obj && followPopup_Bottom_Obj != 'undefined')
hiddenArticleToolbarFloatingDiv('windowfollowcontentbutton');
if (followPopup_Top_Obj && followPopup_Top_Obj != 'undefined')
hiddenArticleToolbarFloatingDiv('windowfollowcontenttop');
if (emailPopup_Bottom_Obj && emailPopup_Bottom_Obj != 'undefined')
hiddenArticleToolbarFloatingDiv('windowcontentbutton');
}
else if (divId == 'windowfollowcontentbutton') { //follow bottom
if (followPopup_Top_Obj && followPopup_Top_Obj != 'undefined')
hiddenArticleToolbarFloatingDiv('windowfollowcontenttop');
if (emailPopup_Top_Obj && emailPopup_Top_Obj != 'undefined')
hiddenArticleToolbarFloatingDiv('windowcontenttop');
if (emailPopup_Bottom_Obj && emailPopup_Bottom_Obj != 'undefined')
hiddenArticleToolbarFloatingDiv('windowcontentbutton');
}
else if (divId == 'windowcontentbutton') { //Email bottom
if (followPopup_Bottom_Obj && followPopup_Bottom_Obj != 'undefined')
hiddenArticleToolbarFloatingDiv('windowfollowcontentbutton');
if (emailPopup_Top_Obj && emailPopup_Top_Obj != 'undefined')
hiddenArticleToolbarFloatingDiv('windowcontenttop');
if (followPopup_Top_Obj && followPopup_Top_Obj != 'undefined')
hiddenArticleToolbarFloatingDiv('windowfollowcontenttop');
}
}//End of function allowOnlyOnePopup
function displayFloatingDiv2(divId, title, width, height, left, top) {
//allowOnlyOnePopup(divId);
document.getElementById('dimmer').style.visibility = "visible";
document.getElementById(divId).style.display = "block";
$(document.getElementById(divId)).find('iframe').show();
document.getElementById(divId).style.width = width + 'px';
document.getElementById(divId).style.height = height + 'px';
document.getElementById(divId).style.left = left + 'px';
document.getElementById(divId).style.top = top + 'px';
if (document.getElementById(divId).className) {
document.getElementById(divId).className = document.getElementById(divId).className + ' dimming';
}
else {
document.getElementById(divId).className = 'dimming';
}
document.getElementById(divId).style.visibility = "visible";
}//End of function displayFloatingDiv2
function hiddenArticleToolbarFloatingDiv(divId) {
//document.getElementById(divId).innerHTML = originalDivHTML;
document.getElementById(divId).style.visibility='hidden';
document.getElementById(divId).style.display = 'none';
$(document.getElementById(divId)).find('iframe').hide();
document.getElementById('dimmer').style.visibility = 'hidden';
DivID = "";
}//End of function hiddenArticleToolbarFloatingDiv
function MouseDown(e) {
if (over) {
if (isMozilla) {
objDiv = document.getElementById(DivID);
X = e.layerX;
Y = e.layerY;
return false;
}
else {
objDiv = document.getElementById(DivID);
objDiv = objDiv.style;
X = event.offsetX;
Y = event.offsetY;
}
}
}//End of function MouseDown
function MouseMove(e) {
if (objDiv) {
if (isMozilla) {
objDiv.style.top = (e.pageY-Y) + 'px';
objDiv.style.left = (e.pageX-X) + 'px';
return false;
}
else {
objDiv.pixelLeft = event.clientX-X + document.body.scrollLeft;
objDiv.pixelTop = event.clientY-Y + document.body.scrollTop;
return false;
}
}
}//End of function MouseMove
function MouseUp() {
objDiv = null;
}//End of function MouseUp
function init() {
// check browser
isMozilla = (document.all) ? 0 : 1;
if (isMozilla) {
document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP);
}
document.onmousedown = MouseDown;
document.onmousemove = MouseMove;
document.onmouseup = MouseUp;
// add the div
// used to dim the page
buildDimmerDiv();
}//End of function init
// call init
init();
// function added to get the position of the Email Story object.
// added on 6th jan 2009
function getPosition(e) {
var left = 0;
var top = 0;
try{
while (e.offsetParent) {
left += e.offsetLeft + (e.currentStyle?(parseInt(e.currentStyle.borderLeftWidth)).NaN0():0);
top += e.offsetTop + (e.currentStyle?(parseInt(e.currentStyle.borderTopWidth)).NaN0():0);
e = e.offsetParent;
}
left += e.offsetLeft + (e.currentStyle?(parseInt(e.currentStyle.borderLeftWidth)).NaN0():0);
top += e.offsetTop + (e.currentStyle?(parseInt(e.currentStyle.borderTopWidth)).NaN0():0);
}
catch(error) {
// for the ie.
var idOfElement=e.id;
var ObjOfEle = eval('document.all.'+idOfElement+'.offsetParent');
while(ObjOfEle.offsetParent) {
left += ObjOfEle.offsetLeft;
top += ObjOfEle.offsetTop;
ObjOfEle = ObjOfEle.offsetParent;
}
left += e.offsetLeft ;
top += e.offsetTop ;
}
return {x:left, y:top};
}//End of function getPosition
//************************************************************************************
function displayWindow(iframelink, extraParamArr) {
var w, h, l, t;
w = 470;
//h = 455;
h = 520;
/*l = screen.width/4;
t = screen.height/4;*/
var n_isMobilePage = iframelink.indexOf("isMobilePage=1");
if (n_isMobilePage >= 0) {
w = 315;
h = 680;
}
currentObj = document.getElementById('emailStoryLinkId');
var currentPosHeightWidth = getPosition(currentObj);
t = currentPosHeightWidth.y+20;
l = currentPosHeightWidth.x;
// with title
displayFloatingDiv2('windowcontenttop', 'Email Story', w, h, l, t);
}//End of function displayWindow
function displayFollowWindow(iframelink, extraParamArr) {
var w, h, l, t;
w = 320;
//h = 455;
h = 520;
/*l = screen.width/4;
t = screen.height/4;*/
currentObj = document.getElementById('followStoryLinkId');
var currentPosHeightWidth = getPosition(currentObj);
t = currentPosHeightWidth.y+20;
l = currentPosHeightWidth.x;
// with title
displayFloatingDiv2('windowfollowcontenttop', 'Follow Story', w, h, l, t);
}//End of function displayFollowWindow
function displayWindowBottom(iframelink, extraParamArr) {
var w, h, l, t;
w = 470;
//h = 455;
h = 520;
/*l = screen.width/4;
t = screen.height/4;*/
var n_isMobilePage = iframelink.indexOf("isMobilePage=1");
if (n_isMobilePage >= 0) {
w = 315;
h = 600;
}
currentObj = document.getElementById('emailStoryLinkId2');
var currentPosHeightWidth = getPosition(currentObj);
t = currentPosHeightWidth.y+20;
l = currentPosHeightWidth.x;
//displayFloatingDiv2(divId, title, width, height, left, top)
// with title
displayFloatingDiv2('windowcontentbutton', 'Email Info', w, h, l, t);
}//End of function displayWindowBottom
function displayFollowWindowBottom(iframelink, extraParamArr) {
var w, h, l, t;
w = 320;
//h = 455;
h = 520;
/*l = screen.width/4;
t = screen.height/4;*/
currentObj = document.getElementById('followStoryLinkId2');
var currentPosHeightWidth = getPosition(currentObj);
t = currentPosHeightWidth.y+20;
l = currentPosHeightWidth.x;
//displayFloatingDiv2(divId, title, width, height, left, top)
// with title
displayFloatingDiv2('windowfollowcontentbutton', 'Follow Story', w, h, l, t);
}//End of function displayFollowWindowBottom
//************************************************************************************
function getCssClassObj(clanSheetame) {
var re = new RegExp(clanSheetame);
var rules, nRule, nRules, SS, nSheet = 0,nSheets = document.styleSheets.length;
for (nSheet; nSheet < nSheets; ++nSheet) {
SS = document.styleSheets.item(nSheet);
rules = (typeof SS.cssRules == 'object')?SS.cssRules:SS.rules;
nRules = rules.length;
for (nRule = 0; nRule < nRules; ++nRule) {
rule = rules.item(nRule);
if (re.test(rule.selectorText)) {
return rule;
//rule.style.fontSize = (parseInt(rule.style.fontSize.replace("%",""))+10)+"%";
}// end if.
}// end for.
}// end for.
}// end function getCssClassObj
//DO NOT MODIFY BELOW
/* Module Change Font (string) */
function changeFont(fontClass,stnBoxIdParam,fromFileCallFlag) {
var element = document.getElementById('blurb_body');
if (stnBoxIdParam && stnBoxIdParam != 'undefined') {
}
else {
stnBoxIdParam = '';
}
//VI-4294
if (fromFileCallFlag && fromFileCallFlag != 'undefined') {
}
else {
fromFileCallFlag = '';
}
if (fromFileCallFlag == 'content_topic_calendar_event_display.lib') {
var element_1 = document.getElementById('calendar_date_container');
var element_2 = document.getElementById('calendar_desc');
var element_3 = document.getElementById('calendar_org_container');
}
if (fromFileCallFlag == 'content_topic_calendar_event_display.lib') {
// get all direct child.
var directChild_1 = element_1.childNodes ;
var directChild_2 = element_2.childNodes ;
var directChild_3 = element_3.childNodes ;
//var directChild = element_1.childNodes ;
/*for(x in directChild_3) {
directChild[x] = directChild_3[x];
}
for(x in directChild_2) {
directChild[x] = directChild_2[x];
}*/
var directChild = new Array();
i = 0;
for (eltIndex = directChild_1.length - 1; eltIndex >= 0; eltIndex--) {
if (directChild_1[eltIndex] && directChild_1[eltIndex] != 'undefined')
directChild[i++] = directChild_1[eltIndex];
}
for (eltIndex = directChild_2.length - 1; eltIndex >= 0; eltIndex--) {
if (directChild_2[eltIndex] && directChild_2[eltIndex] != 'undefined')
directChild[i++] = directChild_2[eltIndex];
}
for (eltIndex = directChild_3.length - 1; eltIndex >= 0; eltIndex--) {
if (directChild_3[eltIndex] && directChild_3[eltIndex] != 'undefined')
directChild[i++] = directChild_3[eltIndex];
}
}
else {
// get all direct child.
var directChild = element.childNodes ;
}
if(directChild.length > 0) {
for(x in directChild) {
try{
switch(fontClass) {
case 'xxsmall_blurb_font':
directChild[x].style.fontSize = "xx-small";
break;
case 'xsmall_blurb_font':
directChild[x].style.fontSize = "x-small";
break;
case 'xlarge_blurb_font':
directChild[x].style.fontSize = "large";
break;
case 'xxlarge_blurb_font':
directChild[x].style.fontSize = "xx-large";
break;
/*case 'medium_blurb_font': //VI-4294
if (fromFileCallFlag == 'content_topic_calendar_event_display.lib') {
directChild[x].style.fontSize = "medium";
}
else { //this will be same as default for article because article donot have this case.
try{
// get all direct child.
//var cssClassObj = getCssClassObj("Box__Font");
var cssClassObj = getCssClassObj("Box_"+stnBoxIdParam+"_Font");
directChild[x].style.fontSize = cssClassObj.style.fontSize;
directChild[x].style.fontFamily = cssClassObj.style.fontFamily;
directChild[x].style.fontWeight = cssClassObj.style.fontWeight;
}catch(e){directChild[x].style.fontSize = "9pt"; directChild[x].style.fontFamily = "Arial, Helvetica, sans-serif";}
//fontClass = "Box__Font";
fontClass = "Box_"+stnBoxIdParam+"_Font";
}
break;*/
default:
try{
// get all direct child.
//var cssClassObj = getCssClassObj("Box__Font");
var cssClassObj = getCssClassObj("Box_"+stnBoxIdParam+"_Font");
directChild[x].style.fontSize = cssClassObj.style.fontSize;
directChild[x].style.fontFamily = cssClassObj.style.fontFamily;
directChild[x].style.fontWeight = cssClassObj.style.fontWeight;
}catch(e){directChild[x].style.fontSize = "9pt"; directChild[x].style.fontFamily = "Arial, Helvetica, sans-serif";}
//fontClass = "Box__Font";
fontClass = "Box_"+stnBoxIdParam+"_Font";
break;
}//End of switch(fontClass)
}catch(e){};
}// end for(x in directChild)
}// end if childs are greater then zero.
if (fromFileCallFlag == 'content_topic_calendar_event_display.lib') { //VI-4294
element_1.className = fontClass;
element_2.className = fontClass;
element_3.className = fontClass;
}
else {
element.className = fontClass;
}
}//End of function changeFont
/*
* Name:
* changeContentFont
* Description:
* copied and modified function changeFont to show font size wise
* Author:
* Rahul Tupparwar [VI-4048]
*/
function changeContentFont(trId,fontClass,stnBoxIdParam) {
var element = "";
$element = $('.'+trId);
switch(fontClass) {
case 'xxsmall_blurb_font':
//$(+"."+trId).css({'fontSize':'xx-small','border':'9px solid red'});
$element.css('fontSize','xx-small');
//$element.css('border','9px solid red');
//directChild[x].style.fontSize = "xx-small";
break;
case 'xsmall_blurb_font':
$element.css('fontSize','x-small');
//element.css({'fontSize':'x-small'});
//directChild[x].style.fontSize = "x-small";
break;
case 'xlarge_blurb_font':
$element.css('fontSize','large');
//element.css({'fontSize':'large'});
//directChild[x].style.fontSize = "large";
break;
case 'xxlarge_blurb_font':
$element.css('fontSize','xx-large');
//element.css({'fontSize':'xx-large'});
//directChild[x].style.fontSize = "xx-large";
break;
default:
try{
// get all direct child.
//var cssClassObj = getCssClassObj("Box_< ?=$stnBoxId ?>_Font");
var cssClassObj = getCssClassObj("Box_"+stnBoxIdParam+"_Font");
$element.css({'fontSize':cssClassObj.style.fontSize});
$element.css({'fontFamily':cssClassObj.style.fontFamily});
$element.css({'fontWeight':cssClassObj.style.fontWeight});
}catch(e){
$element.css({'fontSize':'9pt','fontFamily':'Arial, Helvetica, sans-serif'});
}
//fontClass = "Box_< ?=$stnBoxId ?>_Font";
//fontClass = "Box_"+stnBoxIdParam+"_Font";
}
//element.className = fontClass;
}//End of function changePostFont
function myOpenPrint(url) {
myWindowHandle = window.open(url,'windowName','width=700,height=600,resizable=1,scrollbars=1,location=0');
//myWindowHandle.moveTo(0,0);
if (!myWindowHandle.opener)
myWindowHandle.opener = self;
}//End of function myOpenPrint
//added by karl schipul for [vi-1629]
function iframeHeightCorrector(setHeightNum, iframeWithThisURL){
var elements = document.getElementsByTagName('iframe');
var ilength = elements.length;
var sum = setHeightNum + 50;
while(ilength--){
if(elements[ilength].src == iframeWithThisURL){
elements[ilength].style.minHeight = sum + "px";
}
}
}//End of function iframeHeightCorrector