﻿addEvent(window, "load", deleteBlankDiv);
addEvent(window,"load",deleteBlankH5);
function deleteBlankH5(){
h5s = document.getElementsByTagName('H5');
    for (i=0;i<h5s.length;i++){
        if (navigator.appName.indexOf('Microsoft')!=-1) {
            iText=h5s[i].innerText;
        } else {
            iText=h5s[i].textContent;
        }
        if (iText=='') {
            h5s[i].style.display='none';
        }        
    }
}

function generalTemp() {
    if (Environment == "live") {
        if (document.getElementById("chromemenu") || document.getElementById("login")){
            document.getElementById("navi").style.display = 'block';
        }
        else {
            document.getElementById("navi").style.display = 'none';
        }
    }
}

function addEvent(elm, evType, fn, useCapture)
// addEvent and removeEvent
// cross-browser event handling for IE5+,  NS6 and Mozilla
// By Scott Andrew
{
  if (elm.addEventListener){
    elm.addEventListener(evType, fn, useCapture);
    return true;
  } else if (elm.attachEvent){
    var r = elm.attachEvent("on"+evType, fn);
    return r;
  } else {
    alert("Handler could not be removed");
  }
}

function getElementsByClassName(oElm, strTagName, oClassNames){
	var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	var arrRegExpClassNames = new Array();
	if(typeof oClassNames == "object"){
		for(var i=0; i<oClassNames.length; i++){
			arrRegExpClassNames.push(new RegExp("(^|\\s)" + oClassNames[i].replace(/\-/g, "\\-") + "(\\s|$)"));
		}
	}
	else{
		arrRegExpClassNames.push(new RegExp("(^|\\s)" + oClassNames.replace(/\-/g, "\\-") + "(\\s|$)"));
	}
	var oElement;
	var bMatchesAll;
	for(var j=0; j<arrElements.length; j++){
		oElement = arrElements[j];
		bMatchesAll = true;
		for(var k=0; k<arrRegExpClassNames.length; k++){
			if(!arrRegExpClassNames[k].test(oElement.className)){
				bMatchesAll = false;
				break;
			}
		}
		if(bMatchesAll){
			arrReturnElements.push(oElement);
		}
	}
	return (arrReturnElements)
}

function deleteBlankDiv(){
	divArray = ['module-1col','module-2col','module-3col'];
	for (i=0;i<divArray.length ;i++ )
	{
		classes = getElementsByClassName(document,"DIV",divArray[i]);
		for (j=0;j<classes.length ;j++ )
		{
			if(classes[j].innerHTML==''){
				if (divArray[i]=='module-3col')
				{
					classes[j].style.height = "0px";
					classes[j].style.visibility = "hidden";
					if (navigator.appName.indexOf('Microsoft')!=-1) {
						iText=classes[j].innerText;
					} else {
						iText=classes[j].textContent;
					}
					if (iText=='') {
						classes[j].style.display='none';
					} 
				} else {
					classes[j].style.display = "none";
				}			
			}
		}
	}
}

function WriteToCookie(cookieValue)
{
    var dSquareCookie = getDSquareCookie("FSDsquareCookie");   
    
    //If Cookie does not exist write GUID value to cookie
    if (dSquareCookie == null)
    {
        setDSquareCookie('FSDsquareCookie',cookieValue, 365);
    }
}

function WriteToLoginCookie(cookieValue)
{
   setDSquareCookie('FSDsquareCookie',cookieValue, 365); 
}


function setDSquareCookie(cookieName, cookieValue, days)
{
    //Calculate Expiration period
    if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	
	//Set the cookie
	document.cookie = cookieName+"="+cookieValue+expires+"; path=/";
}

function getDSquareCookie(cookieName) {
	// first we'll split this cookie up into name/value pairs
	// note: document.cookie only returns name=value, not the other components
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false; // set boolean t/f default f
	
	for ( i = 0; i < a_all_cookies.length; i++ )
	{
		// now we'll split apart each name=value pair
		a_temp_cookie = a_all_cookies[i].split( '=' );
		
		
		// and trim left/right whitespace while we're at it
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
	
		// if the extracted name matches passed cookieName
		if ( cookie_name == cookieName )
		{
			b_cookie_found = true;
			// we need to handle case where cookie has no value but exists (no = sign, that is):
			if ( a_temp_cookie.length > 1 )
			{
				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			}
			// note that in cases where cookie is initialized but no value, null is returned
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found )
	{
		return null;
	}
}

function createContractTrackingCookie(cookieValue, domain)
{  	
	var cookieName="MyFSID";
	var cookieDomain="";	
	if(domain && domain != "")
	{	
	    cookieDomain =";domain="+ domain;
	}
	//Set the cookie
	document.cookie = cookieName + "=" + escape(cookieValue) + cookieDomain +"; path=/";
}

var errClass = "fsInput-Error";
//Change the border color of the control
function changeBorderForMyFS(ctrl, changeBorder, frmName)
{   
    var classInputFocus = "fsInput-Focus";
    
    var clsName = new String();
    clsName = ctrl.className;   
    
    if(!$('#'+ ctrl.id).hasClass(errClass))
    {
        if( changeBorder )
        {       
            $('#'+ ctrl.id).addClass(classInputFocus);     
        }
        else
        {           
            $('#'+ ctrl.id).removeClass(classInputFocus);            
        }              
    }
    else
    {
        $('#'+ ctrl.id).removeClass(classInputFocus); 
    }
    if(frmName)
    {
        callParentForResize(frmName);
    }    
}

//Reset the css of input fields and respective labels on calculator pages.
function removeCalcInputError(ctrlID, labelId)
{   
    $('#' + labelId).attr("style","color:#003468");
    //document.getElementById(labelId).style.color = "#003468";
    $('#'+ ctrlID).removeClass("redinput");
    $('#'+ ctrlID).removeClass("redselect");
}

//Reset the css of input fields and respective labels on calculator pages.
function removeFakeError(ctrl) {
    if (ctrl.type != "checkbox") {
        $(ctrl).parent().parent().removeClass("redinput");
    }
    else {
        $(ctrl).removeClass("redselect");
    }
}

function printPage()
{
    window.print();
}

/****************************************Navigation functionality :: Start*********************************************************/
//Chrome Drop Down Menu v2.01- Author: Dynamic Drive (http://www.dynamicdrive.com)
//Last updated: November 14th 06- added iframe shim technique
var arrayAnchr, menuId, arrayLi, initialActive, defActive;
function initialize() {
arrayLi = document.getElementById("chromemenu").getElementsByTagName("li");
arrayAnchr = document.getElementById("chromemenu").getElementsByTagName("a");
for(var i=0; i<arrayLi.length; i++)
	{
		if((arrayLi[i].className).indexOf("-selected")!=-1){
			initialActive = i;
			defActive = arrayLi[i].id; //identify default highlighted tab
			
		}
		
	}
	
}
function highlightTab(menuCount)
{	
	menuId = menuCount.substring(8);
	for(var i=0; i<arrayAnchr.length; i++)
	{
		if((arrayAnchr[i].parentNode.parentNode.className).indexOf("-selected")!=-1)
		{
			arrayAnchr[i].parentNode.parentNode.className = arrayAnchr[i].parentNode.parentNode.id;
	
		}
				arrayAnchr[menuId-1].parentNode.parentNode.className = arrayAnchr[menuId-1].parentNode.parentNode.id + '-active';
	}
}
var userLoggedIn=new String();
function hideTab(menuCount)
{
	
	if ((menuId>0)&&(menuId<7))
	{	
		arrayAnchr[menuId-1].parentNode.parentNode.className = arrayAnchr[menuId-1].parentNode.parentNode.id;
	}
	if (menuId == 7)
	{
	    if(userLoggedIn=='True'){
	    arrayAnchr[menuId-1].parentNode.parentNode.className = arrayAnchr[menuId-1].parentNode.parentNode.id + '-loggedin';
	    }
	    else{
	    arrayAnchr[menuId-1].parentNode.parentNode.className = arrayAnchr[menuId-1].parentNode.parentNode.id;
	    }
	   
	}
	if (defActive!=null)
	{
		document.getElementById(defActive).className = defActive+"-selected"; //if default highlighted tab exists then highlight it on mouseover
	}
	
}
var menuItem;
var menuUserLoggedIn;

function highlightMenu(listId, hasUserLoggedIn) {
    userLoggedIn=hasUserLoggedIn;
	if((document.getElementById(listId).className).indexOf("-selected") > 0)
	    menuUserLoggedIn = true;
	else
	    menuUserLoggedIn = false;
	
	for(var i=0; i<arrayLi.length; i++)
	{
		
		if((arrayLi[i].className).indexOf("-selected")!=-1)
		{
			arrayLi[i].className = arrayLi[i].id;
	
		}
		if((arrayLi[i].className).indexOf("-active")> 0)
		{
			arrayLi[i].className = arrayLi[i].id;
		}
		document.getElementById(listId).className = listId + "-active";
	}
	
	menuItem = listId;
}
function hideMenu(listId) {	
	document.getElementById(listId).className = listId;
	if (defActive!=null)
	{
		document.getElementById(defActive).className = defActive+"-selected"; //if default highlighted tab exists then highlight it on mouseover
	}
	
}

function hideMyFSMenu(listId) {	
	document.getElementById(listId).className = listId + "-loggedin";
	
	if (defActive!=null)
	{
		document.getElementById(defActive).className = defActive+"-selected"; //if default highlighted tab exists then highlight it on mouseover
	}
}

var cssdropdown={
disappeardelay: 250, //set delay in miliseconds before menu disappears onmouseout
disablemenuclick: false, //when user clicks on a menu item with a drop down menu, disable menu item's link?

enableiframeshim: 1, //enable "iframe shim" technique to get drop down menus to correctly appear on top of controls such as form objects in IE5.5/IE6? 1 for yes, 0 for no

//No need to edit beyond here////////////////////////
dropmenuobj: null, ie: document.all, firefox: document.getElementById&&!document.all, swipetimer: undefined, bottomclip:0,

getposOffset:function(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
},

showhide:function(obj, e){
if (this.ie || this.firefox)
this.dropmenuobj.style.left=this.dropmenuobj.style.top="-500px"
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover"){
if (this.enableswipe==1){
if (typeof this.swipetimer!="undefined")
clearTimeout(this.swipetimer)
obj.clip="rect(0 auto 0 0)" //hide menu via clipping
this.bottomclip=0
this.swipeeffect()
}
obj.visibility="visible"
}
else if (e.type=="click")
obj.visibility="hidden"
},

iecompattest:function(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
},

clearbrowseredge:function(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=this.ie && !window.opera? this.iecompattest().scrollLeft+this.iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetWidth
if (windowedge-this.dropmenuobj.x < this.dropmenuobj.contentmeasure)  //move menu to the left?
edgeoffset=this.dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=this.ie && !window.opera? this.iecompattest().scrollTop : window.pageYOffset
var windowedge=this.ie && !window.opera? this.iecompattest().scrollTop+this.iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetHeight

if (windowedge-this.dropmenuobj.y < this.dropmenuobj.contentmeasure){ //move up?
edgeoffset=this.dropmenuobj.contentmeasure+obj.offsetHeight
if ((this.dropmenuobj.y-topedge)<this.dropmenuobj.contentmeasure) //up no good either?
edgeoffset=this.dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
},

dropit:function(obj, e, dropmenuID){
if (this.dropmenuobj!=null) //hide previous menu
this.dropmenuobj.style.visibility="hidden" //hide menu
this.clearhidemenu()
if (this.ie||this.firefox){
obj.onmouseout=function(){cssdropdown.delayhidemenu()}
obj.onclick=function(){return !cssdropdown.disablemenuclick} //disable main menu item link onclick?
this.dropmenuobj=document.getElementById(dropmenuID)
if(this.dropmenuobj)
{

this.dropmenuobj.onmouseover=function(){highlightTab(dropmenuID);cssdropdown.clearhidemenu();}
this.dropmenuobj.onmouseout=function(e){cssdropdown.dynamichide(e);}
this.dropmenuobj.onclick=function(){cssdropdown.delayhidemenu()}
this.showhide(this.dropmenuobj.style, e)
this.dropmenuobj.x=this.getposOffset(obj, "left")
this.dropmenuobj.y=this.getposOffset(obj, "top")
this.dropmenuobj.style.left=this.dropmenuobj.x-this.clearbrowseredge(obj, "rightedge")+5+"px"
this.dropmenuobj.style.top="164px";//this.dropmenuobj.y-this.clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+4+"px"
/*if((this.dropmenuobj.style.top=='35px')||(this.dropmenuobj.style.top=='42px')){
	this.dropmenuobj.style.top=parseInt(this.dropmenuobj.style.top)+8+'px';
}*/
this.positionshim() //call iframe shim function
}
else
{
//do nothing 
}
}
},

positionshim:function(){ //display iframe shim function
if (this.enableiframeshim && typeof this.shimobject!="undefined"){
if (this.dropmenuobj.style.visibility=="visible"){
this.shimobject.style.width=this.dropmenuobj.offsetWidth+"px"
this.shimobject.style.height=this.dropmenuobj.offsetHeight+"px"
this.shimobject.style.left=this.dropmenuobj.style.left
this.shimobject.style.top=this.dropmenuobj.style.top
}
this.shimobject.style.display=(this.dropmenuobj.style.visibility=="visible")? "block" : "none"
}
},

hideshim:function(){
if (this.enableiframeshim && typeof this.shimobject!="undefined")
this.shimobject.style.display='none'
},

contains_firefox:function(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
},

dynamichide:function(e){
var evtobj=window.event? window.event : e
if(this.dropmenuobj)
{
if (this.ie&&!this.dropmenuobj.contains(evtobj.toElement))
this.delayhidemenu()
else if (this.firefox&&e.currentTarget!= evtobj.relatedTarget&& !this.contains_firefox(evtobj.currentTarget, evtobj.relatedTarget))
this.delayhidemenu()
}
else
{
//do nothing
}
},

delayhidemenu:function(){
if(this.dropmenuobj)
{
this.delayhide=setTimeout("hideTab(menuItem);cssdropdown.dropmenuobj.style.visibility='hidden'; cssdropdown.hideshim()",this.disappeardelay) //hide menu
}
else
{
//do nothing
}
},

clearhidemenu:function(){
if(this.dropmenuobj)
{
if (this.delayhide!="undefined")
clearTimeout(this.delayhide)
}
else
{
// Do nothing
}
},

startchrome:function(){
	initialize();
for (var ids=0; ids<arguments.length; ids++)
	{
		var menuitems=document.getElementById(arguments[ids]).getElementsByTagName("a")
		for (var i=0; i<menuitems.length; i++)
			{
				if (menuitems[i].getAttribute("rel"))
					{
						var relvalue=menuitems[i].getAttribute("rel")
						menuitems[i].onmouseover=function(e)
							{
								var event=typeof e!="undefined"? e : window.event
								cssdropdown.dropit(this,event,this.getAttribute("rel"))
							}
					}
			}
	}
if (window.createPopup && !window.XmlHttpRequest)
	{ //if IE5.5 to IE6, create iframe for iframe shim technique
		document.write('<IFRAME id="iframeshim"  src="javascript:false;" style="display: none; left: 0; top: 0; z-index: 90; position: absolute; filter: progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)" frameBorder="0" scrolling="no"></IFRAME>')
		this.shimobject=document.getElementById("iframeshim") //reference iframe object
	}

}

}
/****************************************Navigation functionality :: End*********************************************************/

/****************************************Login functionality :: Start*********************************************************/
/* functions for Login */
var isGenericLogin = true;
function showLogin(loginForm, isGenericLogin)
{
    try {
        window.location = REGISTER_REDIRECT_URL;
//	    if(isGenericLogin)
//	    {
//	        window.location = "/ssl/meine-finanzen-registrierung.aspx";
//			// if loginlayer is opened from the Einloggen link, then hide the myfs login button
//            //ShowGenericLoginLayer(loginForm);
//	    }
//	    else
//	    {
//			window.location = "/ssl/meine-finanzen-registrierung.aspx";
//	        // if loginlayer is opened from the MyFS save button, then hide the general login button
//	        //ShowMyFSLoginLayer(loginForm);
//	    }
	    document.getElementById(txtLoginModeClientId).value = isGenericLogin;
        HideForgottenPwdlayer(divForgotPwd);
	    UnsuppressExitAlertBox();
	}catch(ex){}
	return false;
}


function showLoginNew(loginForm, isGenericLogin)
{
    try {
        window.location = REGISTER_REDIRECT_URL;
//	    if(isGenericLogin)
//	    {
//	        window.location = "/ssl/meine-finanzen-registrierung.aspx";
//			// if loginlayer is opened from the Einloggen link, then hide the myfs login button
//            //ShowGenericLoginLayerNew(loginForm);
//	    }
//	    else
//	    {
//	        window.location = "/ssl/meine-finanzen-registrierung.aspx";
//			// if loginlayer is opened from the MyFS save button, then hide the general login button
//	        //ShowMyFSLoginLayerNew(loginForm);
//	    }
	    document.getElementById(txtLoginModeClientId).value=isGenericLogin;
        HideForgottenPwdlayer(divForgotPwd);
	    UnsuppressExitAlertBox();
	}catch(ex){}
	return false;
}

/* function to show the frgot password layer */
	function showForgotPassword(forgotPassworForm, lblForgotStatus)
	{
		document.getElementById(forgotPassworForm).className="dvLoginForm display-block";
		document.getElementById(lblForgotStatus).className = "display-none";		
	}

/* function to show the frgot password layer */
	function showForgotPasswordLandingPage(forgotPassworForm) {
    document.getElementById(forgotPassworForm).className = "dvLoginForm display-block";    
}
/*
function to close the login form */
	function closeLoginForm(loginForm, forgotPasswordForm, lblLoginStatus, lblForgotStatus) 
	{
		document.getElementById(loginForm).className = "display-none";
		document.getElementById(forgotPasswordForm).className = "display-none";
		document.getElementById(lblLoginStatus).className = "display-none";
		document.getElementById(lblForgotStatus).className = "display-none";
		
	}
	
/* function to show the login layer including forgot password section */
function showLoginLayer(loginForm, forgotPasswordForm,lblForgotStatus, isGenericLogin)    
{
    document.getElementById(forgotPasswordForm).className="dvLoginForm display-block";
    document.getElementById(lblForgotStatus).className += " display-block";
	if(isGenericLogin)
	{
	    // if loginlayer is opened from the Einloggen link, then hide the myfs login button
        ShowGenericLoginLayer(loginForm);
	}
	else
	{
	    // if loginlayer is opened from the MyFS save button, then hide the general login button
	    ShowMyFSLoginLayer(loginForm);
    }
	return false;
}

/* function to show the login layer including forgot password section */
function showLoginLayerNew(loginForm, forgotPasswordForm,lblForgotStatus, isGenericLogin)    
{
    document.getElementById(forgotPasswordForm).className="dvLoginForm display-block";
    document.getElementById(lblForgotStatus).className += " display-block";
	if(isGenericLogin)
	{
	    // if loginlayer is opened from the Einloggen link, then hide the myfs login button
        ShowGenericLoginLayerNew(loginForm);
	}
	else
	{
	    // if loginlayer is opened from the MyFS save button, then hide the general login button
	    ShowMyFSLoginLayerNew(loginForm);
    }
	return false;
}

function transparentLayer(){
DisableInputForm("form1","transparentLayer");
}
/* functions for showing Login layer when the Einloggen link is clicked*/
function ShowGenericLoginLayer(loginForm)
{
    //DisableInputForm("form1","transparentLayer");
    document.getElementById(loginForm).className="display-block";
    document.getElementById(loginForm).style.left = 792+'px';
    document.getElementById(loginForm).style.top = 140+'px';
    document.getElementById(btnloginClientId).className="display-block";
    document.getElementById(lnkRegisterClientId).className="display-block";
    document.getElementById(btnloginMyFSClientId).className="display-none";
    document.getElementById(lnkRegisterMyFSClientId).className="display-none";
}

/* functions for showing Login layer when the MyFS save is clicked*/
function ShowMyFSLoginLayer(loginForm)
{ 
        setNoScrollRequired();
        //DisableInputForm("form1","transparentLayer");
        document.getElementById(loginForm).className="display-block";       
        document.getElementById(btnloginClientId).className="display-none";
        document.getElementById(lnkRegisterClientId).className="display-none";
        document.getElementById(btnloginMyFSClientId).className="display-block";
        document.getElementById(lnkRegisterMyFSClientId).className="display-block"; 
        SaveloginLayer(loginForm);
          
}

/* functions for showing Login layer when the Einloggen link is clicked*/
function ShowGenericLoginLayerNew(loginForm)
{
    //DisableInputForm("form1","transparentLayer");
    document.getElementById(loginForm).className="display-block";
    document.getElementById(loginForm).style.left = 792+'px';
    document.getElementById(loginForm).style.top = 140+'px';
    document.getElementById(btnloginClientId).parentNode.className="button_orange display-block float-right";
    document.getElementById(lnkRegisterClientId).className="display-block";
    document.getElementById(btnloginMyFSClientId).parentNode.className="display-none";
    document.getElementById(lnkRegisterMyFSClientId).className="display-none";
}

/* functions for showing Login layer when the MyFS save is clicked*/
function ShowMyFSLoginLayerNew(loginForm)
{ 
        setNoScrollRequired();
        DisableInputForm("form1","transparentLayer");
        document.getElementById(loginForm).className="display-block";       
        document.getElementById(btnloginClientId).parentNode.className="display-none";
        document.getElementById(lnkRegisterClientId).className="display-none";
        document.getElementById(btnloginMyFSClientId).parentNode.className="button_orange display-block float-right";
        document.getElementById(lnkRegisterMyFSClientId).className="display-block"; 
        SaveloginLayer(loginForm);
          
}

function HideForgottenPwdlayer(forgotPasswordLayer)
{
    document.getElementById(forgotPasswordLayer).className="login-form display-none";
}

function ShowRedirectMessage()
{ 
      var ans = confirm("Über die \"Zurück-Funktion\" im Browser beenden Sie den Vergleich. Ihre Eingabedaten gehen dabei verloren. Möchten Sie nur auf die vorangegangene Seite im Vergleich wechseln, benutzen Sie bitte den \"Zurück-Knopf\" im Vergleichsmodul.");
      if(ans)
      {
           redirectClicked = true;
            linkClicked = true;
            return true;
      }
      else
      {        
            redirectClicked = false;
            return false;
      }
 
}

function LMShowWelcomeLogin(loginForm)
{
    document.getElementById(loginForm).className="display-none";    
}

function LMShowUserLogout(loginForm, forgotPasswordForm)
{
    document.getElementById(loginForm).className="display-block";    
    document.getElementById(forgotPasswordForm).className="display-none";  
     
}

/* Method added for show campaign via login story */
function showCampaignBlock(dvid) {
		positionCenterCampaignLayer(dvid);
		document.getElementById(dvid).style.display = "block";
}

/* Method added for hide campaign via login story */
function closeCampaignLayer(dvid,redirectionLoginURL){
	document.getElementById(dvid).style.display="none";
	/* Redirects the page to the Login redirect rule 
	* Purti Malhotra  15-Oct-2008  Changes corresponding to artf782052: Login Module | Redirect the user to new page after login
	*/
	if(redirectionLoginURL !=undefined)
		   {
		   document.location.href=redirectionLoginURL;
		   }
}

/* Method added for show campaign via login story */
function positionCenterCampaignLayer(boxElem)
{
            document.getElementById(boxElem).style.display='block'; 
            document.getElementById(boxElem).style.visibility='hidden'; 
            

            var browsername=navigator.appName;
            if (browsername.indexOf("Microsoft")!=-1){
		        elemHeight = document.documentElement.clientHeight;
		        scrolly = document.documentElement.scrollTop;
            } else {
                elemHeight = window.innerHeight;
                scrolly = window.scrollY;                
	        }
	     
	       elemTop = parseInt((elemHeight - document.getElementById(boxElem).offsetHeight)/2);
	       document.getElementById(boxElem).style.top=elemTop+scrolly+'px';
	       document.getElementById(boxElem).style.left='210px';
		   document.getElementById(boxElem).style.position='absolute';
		   document.getElementById(boxElem).style.visibility='visible'; 
 }
 /****************************************Login functionality :: End*********************************************************/
 
  /****************************************Toolbar functionality :: Start*********************************************************/

 function showArticleConfirmation() {
	    positionCenterToolBar("dvArticleMainPopup");
	   document.getElementById("dvArticleDetails").style.display = "none";
		document.getElementById("dvArticleConfirmation").style.display = "block";
        }
function sendMailURL(URL) {	
		         
        
        document.getElementById("dvArticleDetails").style.display = "block";
		document.getElementById("dvArticleConfirmation").style.display = "none";		
        if(URL !=undefined)
            {
            document.getElementById(urlHiddenField).setAttribute('value',String(URL));
            }
         else
            {
            document.getElementById(urlHiddenField).setAttribute('value',"");
            }
         positionCenterToolBar("dvArticleMainPopup");

     }
	
function swapBox()
{
    var inputContentHeight = document.getElementById('contentBox').offsetHeight;
    var inputSeoHeight = document.getElementById('tabBox').offsetHeight;

    if (document.getElementById("diesenav"))
    {
	     document.getElementById('tabBox').style.position="relative";
	     document.getElementById('tabBox').style.marginTop=inputContentHeight + 'px';
	     document.getElementById('contentBox').style.position = "absolute";
	     if (document.getElementById("dvPageTitle")) 
	     {
	        var pageTitle = document.getElementById("dvPageTitle").offsetHeight
	        document.getElementById('contentBox').style.top = pageTitle + 'px';
	     }
	     else 
	     {
	         document.getElementById('contentBox').style.top = 0 + 'px';
	     }
	 }
	 document.getElementById('tabBox').style.display='block';
	 document.getElementById('tabBox').style.visibility='visible';
	 return true;
}
function showArticleBlock() 
{	
        positionCenterToolBar("dvArticleMainPopup");
        document.getElementById("dvArticleDetails").style.display = "block";
        document.getElementById("dvArticleConfirmation").style.display = "none";		
}

function closeArticleLayer(dvid)
{
	document.getElementById(dvid).style.display="none";
}
    

	function ShowToolbar(){
	document.getElementById("toolbox-print").style.display = "none";
	document.getElementById("toolbox-control").style.display = "block";
	}
	
    /* Code change starts here
     * artf740552 : 3.1 - send article: prefill of senders data
     * Updated by :- Pulkit Jain
     * Change Done :- Added javascript function fillTextBoxes to fill the username and emailid when a myfs user is logged in
     *                and added code to clear error message in the function clearFormatting
     */
     
	function fillTextBoxes(controlSenderNameId,controlSenderNameValue,controlSenderEmailId,controlSenderEmailValue)
	{
	    document.getElementById(controlSenderNameId).value=controlSenderNameValue;
	    document.getElementById(controlSenderEmailId).value=controlSenderEmailValue;
	}
	function clearFormatting(controlId1, controlId2, controlId3, controlId4, controlId5, controlId6){
	document.getElementById(controlId1).style.color='';
	document.getElementById(controlId2).style.color='';
	document.getElementById(controlId3).style.color='';
	document.getElementById(controlId4).style.color='';
	document.getElementById(controlId5).style.color='';
	document.getElementById(controlId6).Text='';
	document.getElementById(controlId6).style.display = "none";
	}
	
	/* Code change ends here
     * artf740552 : 3.1 - send article: prefill of senders data
     * Updated by :- Pulkit Jain
     * Change Done :- Added javascript function fillTextBoxes to fill the username and emailid when a myfs user is logged in
     *                and added code to clear error message in the function clearFormatting
     */
	function clearTextBoxes(controlId1, controlId2, controlId3, controlId4, controlId5)
	{
	    document.getElementById(controlId1).value='';
	    document.getElementById(controlId2).value='';
	    document.getElementById(controlId3).value='';
	    document.getElementById(controlId4).value='';
	    document.getElementById(controlId5).value='';
	    //Remove error classes as well.
	    var errorClass='fsInput-Error';
	    $('#'+ controlId1).removeClass(errorClass); 
	    $('#'+ controlId2).removeClass(errorClass); 
	    $('#'+ controlId3).removeClass(errorClass); 
	    $('#'+ controlId4).removeClass(errorClass); 
	    $('#'+ controlId5).removeClass(errorClass); 	    
	}
	
	function positionPopup(){
	    var offset = $("#toolbox-control").offset();
	    if ($.browser.msie) {
	     $("#dvArticleMainPopup").css("top", (offset.top - $("#dvArticleMainPopup").height() + 7) + "px");
	     }
	     else
	     {
	     $("#dvArticleMainPopup").css("top", (offset.top - $("#dvArticleMainPopup").height() + 7) + "px");
	     }	     
	}
	
    
   function positionCenterToolBar(boxElem)
   {
            document.getElementById(boxElem).style.display='block'; 
            document.getElementById(boxElem).style.visibility='hidden'; 
            

            var browsername=navigator.appName;
            if (browsername.indexOf("Microsoft")!=-1){
		        elemHeight = document.documentElement.clientHeight;
		       // elemWidth = document.documentElement.clientWidth;
		        scrolly = document.documentElement.scrollTop;
            } else {
                elemHeight = window.innerHeight;
               // elemWidth = window.innerWidth;
                scrolly = window.scrollY;                
	        }
	        elemTop = parseInt((elemHeight - document.getElementById(boxElem).offsetHeight)/2);
	        //elemLeft = parseInt((elemWidth - document.getElementById(boxElem).offsetWidth)/2);
	        document.getElementById(boxElem).style.top=elemTop+scrolly+'px';
	       // document.getElementById(boxElem).style.left=elemLeft+'px';
	        document.getElementById(boxElem).style.left='210px';
			document.getElementById(boxElem).style.position='absolute';
			document.getElementById(boxElem).style.visibility='visible'; 
        }
/****************************************Toolbar functionality :: End*********************************************************/

function highlightMehrInfo(moreInfoMenu, moreInfoMenuItems) {
document.getElementById(moreInfoMenu).className = "mehr-info-active";
document.getElementById(moreInfoMenuItems).style.display='block';
showMehrLayer(moreInfoMenu, moreInfoMenuItems);
}

function hideMehrInfo(moreInfoMenu, moreInfoMenuItems) {
document.getElementById(moreInfoMenu).className = "mehr-info";
document.getElementById(moreInfoMenuItems).style.display='none'; }



//Function to open popup for footer images.
//Created by: Gaurav Shukla
//Created On: 27/10/2009

function OpenPopupForFooterImage(url)
{
    window.open(url, '','location=false,status=1,width=800,height=700,toolbar=0,resizable=yes,scrollbars=1,top=200,left=250')    
}


/*
* jQuery Watermark Plugin (v1.0.0)
*   http://updatepanel.net/2009/04/17/jquery-watermark-plugin/
*
* Copyright (c) 2009 Ting Zwei Kuei
*
* Dual licensed under the MIT and GPL licenses.
*   http://www.opensource.org/licenses/mit-license.php
*   http://www.opensource.org/licenses/gpl-3.0.html
*/
(function($) {
    $.fn.updnWatermark = function(options) {
        options = $.extend({}, $.fn.updnWatermark.defaults, options);
        return this.each(function() {
            var $input = $(this);
			// Checks to see if watermark already applied.
            var $watermark = $input.data("updnWatermark");
            // Only create watermark if title attribute exists
            if (!$watermark && this.title) {
				// Inserts a span and set as positioning context
                var $watermark = $("<span/>")
					.addClass(options.cssClass)
                    .insertBefore(this)
                    .hide()
					.bind("show", function() {
                        $(this).children().fadeIn("fast");
                    })
                    .bind("hide", function() {
                        $(this).children().hide();
                    });
				// Positions watermark label relative to positioning context
				$("<label/>").appendTo($watermark)
                    .text(this.title)
                    .attr("for", this.id);
				// Associate input element with watermark plugin.
                $input.data("updnWatermark", $watermark);
            }
			// Hook up blur/focus handlers to show/hide watermark.
            if ($watermark) {
                $input
                    .focus(function(ev) {
                        $watermark.trigger("hide");
                    })
                    .blur(function(ev) {
                        if (!$(this).val()) {
                            $watermark.trigger("show");
                        }
                    });
                // Sets initial watermark state.
                if (!$input.val()) {
                    $watermark.show();
                }
            }
        });
    };
    $.fn.updnWatermark.defaults = {
        cssClass: "updnWatermark"
    };
    $.updnWatermark = {
        attachAll: function(options) {
			$("input:text[title!=''],input:password[title!=''],textarea[title!='']").updnWatermark(options);
        }
    };
})(jQuery);

function getPopunderCookie(Name) {
  var search = Name + "=";
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) {
      offset += search.length
      end = document.cookie.indexOf(";", offset);
      if (end == -1)
         end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvalue;
}

function loadPopunder(puURL, puTitle, puWidth, puHeight){    
    
    //check if url contains any query string or not, if yes then append else create
    var qryString = "PopunderTitle=" + puTitle;
    puURL +=  (puURL.indexOf("?") > 0) ?  "&" + qryString : "?" + qryString;     
    
    //changed for artf1120809 for Release 7.12.0.0.Please note that resizing for pop-ups 
    // will not work in firefox for this set dom.disable_window_open_feature.resizable to false 
    var winfeatures = "width="+puWidth+",height="+puHeight+",scrollbars=no,resizable=no,toolbar=no,location=no,menubar=no,status=no,directories=no,copyhistory=no";
    var puWin = window.open(puURL, "", winfeatures);     
    //puWin.document.title = puTitle;        
    if(puWin)
    {
        puWin.blur()
    }
    window.focus()
}

function displayPopunder(puURL, puTitle, puWidth, puHeight){
    if (getPopunderCookie('FS24popunder')==''){
        loadPopunder(puURL, puTitle, puWidth, puHeight);
        document.cookie="FS24popunder=yes";
    }
}
