    function setHelpIndicator()
    {
    document.getElementById("fromHelp").value="true";
    }
    function popUp1(URL)
        {
         
            eval("poppage = window.open(URL , 'poppage', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=450,height=420,left = 162,top = 134');");
            
        }
        function showDivs(str,loginStat)
            {
            if(document.getElementById("Hidden3").value=="true")
            {
             document.getElementById("Content4").style.height="327px";
             document.getElementById("Content4").firstChild.style.height="325px";
            }
	        if(document.getElementById("Hidden41").value=="true")
	        {
		        if(visibleRows == 1)
		        {
			        document.getElementById("Content3").style.height="138px";
    		        document.getElementById("Content3").firstChild.style.height="136px";
		        }
		        else if(visibleRows == 2)
		        {
			        document.getElementById("Content3").style.height="158px";
    		        document.getElementById("Content3").firstChild.style.height="156px";
		        }
		        else if(visibleRows == 3)
		        {
			        document.getElementById("Content3").style.height="178px";
    		        document.getElementById("Content3").firstChild.style.height="176px";
		        }
	        }
            var temp = new Array();
            var livDivs = new Array();
            temp = str.split(",");
            var i=0;
            var LivCounter=0;
            
            for(var c=0;c<16;c=c+2)
                {
                if(loginStat=='True')
                        {
		                    if(temp[c]==1 )
		                        {
		                            document.getElementById("Content"+(i+1)).style.display="";
		                            livDivs[LivCounter]=i;
		                            LivCounter++;		                    
		                        }
		                     else
		                        {
		                            document.getElementById("Content"+(i+1)).style.display="none";
		                        }
		                        i++;
		                  }
		             else
		                 {
		                   if(temp[c]==1 && temp[c+1]=='N')
		                        {
		                            document.getElementById("Content"+(i+1)).style.display="";
		                            livDivs[LivCounter]=i;
		                            LivCounter++;	
		                        }
		                     else
		                        {
		                            document.getElementById("Content"+(i+1)).style.display="none";
		                        }
		                        i++;
		                  }
                 }
       if(navigator.appName=="Netscape")
       {
    	    for(LivCounter=0;LivCounter<livDivs.length;LivCounter++)
	        {
	         document.getElementById("Content"+(livDivs[LivCounter]+1)).firstChild.style.width="388px";
	        }
	         gapDivs=10;
       }
       else
       {
        gapDivs=8;
       }
         var leftMargin=10;
         var topMargin =10;
         var widthDiv=390;
         var x1=leftMargin;
         var x2=leftMargin+widthDiv+10;
         var y1=topMargin ;
         var y2=topMargin ;
         var height =100;
         var lastHeight1;
         var lastHeight2;
         var column=1;
         var pos;
         if(livDivs.length>0)
         {
         document.getElementById("Content"+(livDivs[0]+1)).style.left=x1+"px";
         document.getElementById("Content"+(livDivs[0]+1)).style.top=y1+"px";
         lastHeight1=document.getElementById("Content"+(livDivs[0]+1)).style.height;
	     pos=lastHeight1.indexOf('px');
	     lastHeight1=lastHeight1.substring(0,pos); 	 
         } 
         if(livDivs.length>1)
         {
          document.getElementById("Content"+(livDivs[1]+1)).style.left=x2+"px";
          document.getElementById("Content"+(livDivs[1]+1)).style.top= y2+"px"; 
          lastHeight2=document.getElementById("Content"+(livDivs[1]+1)).style.height;
	      pos=lastHeight2.indexOf('px');
	      lastHeight2=lastHeight2.substring(0,pos); 
         }
         else
         {
         y2=0;
         lastHeight2=0;
         }
         for(LivCounter=2;LivCounter<livDivs.length;LivCounter++)
	        {
		       height=document.getElementById("Content"+(livDivs[LivCounter-2]+1)).style.height;
		       pos=height.indexOf('px');
		       height=height.substring(0,pos);
		       if(column==1)
				        {
				     	    y1=parseInt(y1)+parseInt(gapDivs)+parseInt(height);
					          document.getElementById("Content"+(livDivs[LivCounter]+1)).style.left=x1+"px";
					          document.getElementById("Content"+(livDivs[LivCounter]+1)).style.top= y1;
					          column=2;
					          lastHeight1=document.getElementById("Content"+(livDivs[LivCounter]+1)).style.height;
						      pos=lastHeight1.indexOf('px');
						      lastHeight1=lastHeight1.substring(0,pos); 	      
		      		    }
		      		    else
		      		    {
		      			    y2=parseInt(y2)+parseInt(gapDivs)+parseInt(height);
					          document.getElementById("Content"+(livDivs[LivCounter]+1)).style.left=x2+"px";
					          document.getElementById("Content"+(livDivs[LivCounter]+1)).style.top= y2;
					          column=1;
					          lastHeight2=document.getElementById("Content"+(livDivs[LivCounter]+1)).style.height;
						      pos=lastHeight2.indexOf('px');
						      lastHeight2=lastHeight2.substring(0,pos); 
					    }	  
	        }
	        var maxHeight1;
	        var maxHeight2;
          if( livDivs.length>0)
          {
                maxHeight1=parseInt(y1)+parseInt(lastHeight1);
		        maxHeight2=parseInt(y2)+parseInt(lastHeight2);
		        if(maxHeight1>maxHeight2)
		        {
		            if(document.getElementById("Hidden1").value=="false")
       			     {
        			     if(maxHeight1<326)
				          {
				          maxHeight1=326;
				          }
				      }
				      else
				      {
				  	      if(maxHeight1<175)
				          {
				          maxHeight1=175;
				          }

				      }
				      document.getElementById("topLevelBox").style.height=parseInt(maxHeight1)+parseInt("10")+"px";   
		        }
		        else
		        {
		          if(document.getElementById("Hidden1").value=="false")
       			     {
        			     if(maxHeight2<326)
				          {
				          maxHeight2=326;
				          }
				      }
				      else
				      {
				  	      if(maxHeight2<175)
				          {
				          maxHeight2=175;
				          }
				      }
				      document.getElementById("topLevelBox").style.height=parseInt(maxHeight2)+parseInt("10")+"px";   
		        }
            }
            else
            {
	            if(document.getElementById("Hidden1").value=="false")
			     {
			        maxHeight2=326;
    			  			       
			      }
			      else
			      {
			          maxHeight2=175;
			      }
			      document.getElementById("topLevelBox").style.height=parseInt(maxHeight2)+parseInt("10")+"px";   
            }
	     }
    function decideHide()
        {	
        var img
            if(document.getElementById("Hidden1").value=="true")
            {
        	    document.getElementById("LabelHolder").style.display="none"; 
                document.getElementById("customPane").style.display="none"; 
                document.getElementById("Hidden1").value="false";
  			    img= document.getElementById("ImageHolder").firstChild;
  			    img.src="/sites/Etihad/PublishingImages/yourpageplus.JPG"
             }
         else
            {
        	    document.getElementById("LabelHolder").style.display=""; 
                document.getElementById("Hidden1").value="true";
                document.getElementById("customPane").style.display=""; 
                img= document.getElementById("ImageHolder").firstChild;
  			    img.src="/sites/Etihad/PublishingImages/yourpageclickimage.JPG"
            }
            Refresh();
         }
    function initialize(loginStat)
    {
        createLinks();
	    var str;
	    document.getElementById("Hidden1").value="true";
	    if(loginStat=='True')
	    {
	    document.getElementById("Hidden2").value="True";
	    }
	    else
	    {
	     document.getElementById("Hidden2").value="false";
	    }
	    if(navigator.appName == "Netscape")
	    {
		    if(readCookie('DivCookies')!=null)
	        {
	          str=readCookie('DivCookies');
	        }
		    else
	        {
	          str='1,L,1,L,1,L,1,L,1,N,1,N,1,N,1,N,';
	        }
	     }
	     else
	     {
		     if(readCookie('DivCookies'))
	 	    {
	          str=readCookie('DivCookies');
	        }
		    else
	        {
	          str='1,L,1,L,1,L,1,L,1,N,1,N,1,N,1,N,';
	        }
 	     }
	    setAll(loginStat,null);
	    showDivs(str,loginStat);
	    if(navigator.appName == "Netscape")
	    {
	    document.getElementById("topLevelBox").style.width='800px';	
	    document.getElementById("topLevelBox").style.borderRightWidth='10px';
	    }
	     else
	    {
	      document.getElementById("topLevelBox").style.width='810px';	
	      document.getElementById("topLevelBox").style.borderRightWidth='8px';	
	     }
    }
    function changeHeightQuickMileage()
    {
    document.getElementById("Hidden3").value="true" ;
    Refresh();
    }
    function changeHeightWYF()
    {	
	    document.getElementById("Hidden41").value="true" ;
	    Refresh();
    }
    function Refresh()
    {
    var loginStat;
	     if(document.getElementById("Hidden2").value=='True')
	     {
	     loginStat='True';
	     }
	     else
	     {
	     loginStat='False';
	     }
    	
        chkall(loginStat,"Temp");
    }   
    function Submit1_onclick()
        {
            if(document.getElementById("Hidden2").value=='True')
            {
            chkall('True',"Perm");
            }
            else
            {
            chkall('False',"Perm");
            }
        }
    function Cancel_onclick()
	    {
		    if(document.getElementById("Hidden2").value=='True')
            {
        	    setAll('True',null);
            }
            else
            {
        	    setAll('False',null);
            }
        	    Refresh();
	    }
    function SaveValue()
	    {
	    if(document.getElementById("Hidden2").value=='True')
            {
            chkall('True',"Perm1");
            }
            else
            {
            chkall('False',"Perm1");
           }
	    }
    function setAll(loginStat,tempVal)
    {
	    if(tempVal==null)
	    {
	     if(navigator.appName == "Netscape")
	    {
		    if(readCookie('DivCookies')!=null)
	        {		
	             str1=readCookie('DivCookies');
	        }
		    else
	        {
	           str1="1,L,1,L,1,L,1,L,1,N,1,N,1,N,1,N,";
	        }
	     }
	     else
	     {
		     if(readCookie('DivCookies'))
	        {
	            str1=readCookie('DivCookies');
	        }
		    else
	        {
	           str1="1,L,1,L,1,L,1,L,1,N,1,N,1,N,1,N,";
	        }
    	
	     }
	    }
	     else
	      {
		    str1=tempVal;
	      } 
    	
    var temp = new Array();
    temp = str1.split(",");
    var str=null;
    var c=0;
    var node = document.getElementById("customPane");
    var childtb;
    var childtr;
    var childtd;
    var childbox;
    childtb=node.firstChild.lastChild; 
    childtr=childtb.firstChild; 
    var trNo=1;
	    while(childtr!=null)
	    {
	    childtd=childtr.firstChild; 
	     var flag;
	     flag=1;
	     var tdNo=1;
      while(flag!=null)
        {
    	    if(loginStat=='True')
            {
                 if (temp[c]=="1"  )
                {
                  childtd.firstChild.checked=true;
                }
         	    else
                {
                  childtd.firstChild.checked=false;
                }
            }
           else
           {
                if(temp[c+1]=="L")
                {
                    if (temp[c]=="1")
                    {
                      childtd.firstChild.checked=true;
                    }
             	    else
                    {
                      childtd.firstChild.checked=false;
                    }
                childtd.firstChild.disabled=true;
                
                }
                else
                {
                      if (temp[c]=="1")
                    {
                   
                      childtd.firstChild.checked=true;
                    }
             	    else
                    {
                        childtd.firstChild.checked=false;
                    }
                }
            }
		    childtd=childtd.firstChild.parentNode;
		    if(temp[c+1]=="L" && childtd.firstChild.checked==true)
            {
            childtd.style.backgroundColor = "#a1d4d9";
            childtd.style.color = "#000000";
            }
            else if(temp[c+1]=="L" && childtd.firstChild.checked==false)
            {
            childtd.style.backgroundColor = "#29b5bd";            
            } 
		    else if(temp[c+1]=="N" && childtd.firstChild.checked==true)
            {
            childtd.style.backgroundColor = "#f6bb92";
            childtd.style.color = "#000000";
            } 
		    else if(temp[c+1]=="N" && childtd.firstChild.checked==false)
            {
            childtd.style.backgroundColor = "#ee813d";   
            } 
            if(trNo!=3)
             {
               if(tdNo<3)
               {
                childtd=childtd.nextSibling;
                }
                else
                {
                flag=null;
                }
              }
              else
              {
              if(tdNo<2)
               {
                childtd=childtd.nextSibling;
                }
                else
                {
                flag=null;
                }
              }
            c=c+2; 
            tdNo=tdNo+1;
      }	
      if(trNo<3)
      {
       childtr=childtr.nextSibling;
      }
      else
      {
        childtr=null;
      }
      trNo=trNo+1;      
     }
    return false; 	   
    }  
        function chkall(loginStat,saveStat)
        {
             var str=null;
             var node = document.getElementById("customPane");
             var child= node.firstChild; 
             var child= node.firstChild; 
   	         var childtb;
   	         var childtr;
            var childtd;
            var childbox;
            childtb=node.firstChild.lastChild; 
            childtr=childtb.firstChild; 
            var loginStr='L,L,L,L,N,N,N,N,';
            var temp = new Array();
	        temp = loginStr.split(",");
            var c=0;
             var trNo=1;
            while(childtr!=null)
            {
            childtd=childtr.firstChild; 
             var flag;
             flag=1;
             var tdNo=1;
              while(flag!=null)
                {
			         if(str!=null)
                        {
                           if (childtd.firstChild.checked)
                                {
                                    str=str+"1,"+temp[c]+",";
                                }
                            else
                                {
                                    str=str+"0,"+temp[c]+",";   
                                 }
                        }
                    else
                        {
                           if (childtd.firstChild.checked)
                                {
                                    str="1,"+temp[c]+",";
                                }
                            else
                                {
                                    str="0,"+temp[c]+",";   
                                 }
                  }
  			        childtd=childtd.firstChild.parentNode;
                    if(trNo!=3)
                     {
                       if(tdNo<3)
                       {
                        childtd=childtd.nextSibling;
                        }
                        else
                        {
                        flag=null;
                        }
                      }
                      else
                      {
                      if(tdNo<2)
                       {
                        childtd=childtd.nextSibling;
                        }
                        else
                        {
                        flag=null;
                        }
                      }
                    c=c+1; 
                    tdNo=tdNo+1;
              }	
              if(trNo<3)
              {
               childtr=childtr.nextSibling;
              }
              else
              {
                childtr=null;
              }
              trNo=trNo+1;      
             }
             if(saveStat=="Temp")
             {
                  setAll('True',str);
             }
             else if(saveStat=="Perm1")
             {
                createCookie('DivCookies',str,365);
             }
             else
             {
                createCookie('DivCookies',str,365);
                alert("Settings saved successfully");
             }
             
             showDivs(str,loginStat);
             return false; 	      
        }
     function createLinks()
    {
	    document.getElementById("Content8").firstChild.style.height="25px";
	    document.getElementById("Content8").style.height="25px";
	    var str1=readCookie('ListLinks');
	    child =document.getElementById("Alllinkcontainer");
	    child=child.firstChild;
	    lbl=child.nextSibling;
	    lbl.style.display='none';	
	    child=child.firstChild;
   	    if(str1!=null)
	    {
	        var temp = new Array();
		    temp = str1.split('^');
		    var direct=0;
		    var heightAdd;
		    heightAdd="30";
		    var countFirstTD;
		    var countSecondTD;
		    var multiplyFactor;
		    var lengthFirstTD;
            var textNode;
            var anchor ;
		    for(var j = temp.length -1;  (j>temp.length-41)&&(j>-1); j=j-2) 
		    {
		    countSecondTD=0;
		    countFirstTD=0;	
			                mycurrent_row = document.createElement("tr");
						    mycurrent_row.setAttribute("width","100%");
			                mycurrent_cell = document.createElement("td");
			                mycurrent_row.appendChild(mycurrent_cell);
            		        mycurrent_cell.setAttribute("width","10px");
		                    mycurrent_cell = document.createElement("td");
		                    textNode=document.createTextNode(temp[j-1]);
		                    anchor = document.createElement("a");
		                    anchor.setAttribute("href",temp[j]);
						    anchor.appendChild(textNode);
		 				    mycurrent_cell.appendChild(anchor);
		 				    mycurrent_cell.setAttribute("width","180px");
		                    mycurrent_row.appendChild(mycurrent_cell);
		                   lengthFirstTD=textNode.length
		                   if(lengthFirstTD > 25)
		                   {
			                   countFirstTD=lengthFirstTD/25;
			               }
			             countFirstTD=parseInt(countFirstTD)+1;
		                    mycurrent_cell = document.createElement("td");
		                    mycurrent_cell.setAttribute("width","10px");
		                     mycurrent_row.appendChild(mycurrent_cell);
		                    j=j-2;
		                    direct=1;
		                    if( j >0)
		                    {
		                     mycurrent_cell = document.createElement("td");
		                    textNode=document.createTextNode(temp[j-1]);
		                    anchor = document.createElement("a");
		                    lengthSecondTD=textNode.length
		                    if(lengthSecondTD> 25)
		                    {
   			                     countSecondTD=lengthSecondTD/25;
   			                 }
  			                countSecondTD=parseInt(countSecondTD)+1;
		                    anchor.setAttribute("href",temp[j]);
		              	    anchor.appendChild(textNode);
		 				    mycurrent_cell.appendChild(anchor);
		 				    mycurrent_cell.setAttribute("width","180px");
		                    mycurrent_row.appendChild(mycurrent_cell);
		                    }		
		                 if(parseInt(countFirstTD) > parseInt(countSecondTD))
		                 {
		             	    multiplyFactor=parseInt(countFirstTD) ;
		                 }
		                 else
		                 {
		                 multiplyFactor=parseInt(countSecondTD);
		                 }
		                 heightAdd=parseInt(heightAdd)+parseInt("15")*parseInt(multiplyFactor);  
                         heightAdd=parseInt(heightAdd)+parseInt("6");  
		                child.appendChild(mycurrent_row);
		            }
		     document.getElementById("Content8").firstChild.style.height=parseInt(heightAdd)+"px";       
		     document.getElementById("Content8").style.height=parseInt(heightAdd)+parseInt("2")+"px";
		     }
		     else
		     {
			    child =document.getElementById("Alllinkcontainer");
			    child=child.firstChild;
			    lbl=child.nextSibling;
			    lbl.style.display="";	
		     heightAdd="60";
		     document.getElementById("Content8").firstChild.style.height=parseInt(heightAdd)+"px";       
		     document.getElementById("Content8").style.height=parseInt(heightAdd)+parseInt("2")+"px";
		     }
    }
       function FindBrowser()
    {	
	     var browserName=navigator.appName;	
               if(browserName=="Netscape")
           	    {
				    document.getElementById("LabelHolder").style.width="800px";		
			    }
    }
function dynamicHeightForRewardsUC()
	{
		if(iRewardsCount==3)
		{
			document.getElementById("Content2").style.height = "172px";
			document.getElementById("internal2").style.height = "170px";
		}
		else if(iRewardsCount==2)
		{
			document.getElementById("Content2").style.height = "160px";
			document.getElementById("internal2").style.height = "158px";
		}
		else
		{
			document.getElementById("Content2").style.height = "148px";
			document.getElementById("internal2").style.height = "146px";
		}
	}
