// This file is automatically included by javascript_include_tag :defaults

function fix_screen_height_module(screen_height_ie,screen_height_mor){

 var browser = navigator.appName;
              if (browser == "Microsoft Internet Explorer"){
         
               var screen_height=screen.height;
               screen_height1=screen_height-150;
              var screen_height_box=screen_height-screen_height_ie;
              height_of_page = document.getElementById('module_body_id').offsetHeight;
              var realHeight = document.getElementById('module_body_id').offsetHeight;
              scro = document.getElementById('module_body_id').scrollHeight;
              off = document.getElementById('module_body_id').offsetHeight;
              goff = $('super_parent_id').getHeight();
            
              if ( realHeight < screen_height1)
              {
                  
                  $$('.super_main_body_box')[0].setStyle({height:screen_height_box +'px'})  
              }
              else
              {
            
                      
                  
              }
    }
    else
    {
 var  yWithScroll = window.innerHeight + window.scrollMaxY;
 var  xWithScroll = window.innerWidth + window.scrollMaxX;
 var w =xWithScroll-30;
               
              var screen_height2=screen.height;
              var screen_height=screen_height2-350;
              
              
              height_of_page = document.getElementById('module_body_id').offsetHeight;
              var realHeight = document.documentElement.scrollHeight;
            
              var vi = yWithScroll;
             
               if ( vi < screen_height )
              {
               
                  $$('.super_main_body_box')[0].setStyle({height:vi +'px'})
                    
               
              }
              else{
         
             
              } 
   
    
    }        
   
}
function fix_screen_height_module_content(screen_height_ie,screen_height_mor){
 var browsername=browser_name();
 var browser = navigator.appName;
 
 var docelement=document.getElementById('module_introduction')
 
 if(!docelement)return;
 
              if (browser == "Microsoft Internet Explorer"){
         
               var screen_height=screen.height;
              var  screen_height1=screen_height-150;
              var screen_height_box=screen_height-screen_height_ie;
 
              
              if(docelement)
              {
              
                  
                  var realHeight = docelement.offsetHeight;
                  scro = docelement.scrollHeight;
             
             
                
                  if (scro < screen_height1)
                  {
                      
                      $$('.introduction_page')[0].setStyle({height:screen_height_box +'px'})  
                  }
                  else
                  {
                  }
              }
    }
     else if(browsername =="Safari")
       {
     

        var screen_height=screen.height;
        
              var  screen_height1=screen_height-150;
             
              var screen_height_box=screen_height-screen_height_ie ;

              var realHeight = docelement.offsetHeight;

              var l=realHeight-150;
 
              var s=realHeight;
    
              var hgt=screen_height1-120;

             scro =docelement.scrollHeight;
            
    

              if ( scro < screen_height1)
                {
        
                $$('.introduction_page')[0].setStyle({height:screen_height_box +'px'})  
  

               
              }
              else 
              
              { 

             
     
     
              }
              
   
         }
  
    else
    {
        var  yWithScroll = window.innerHeight + window.scrollMaxY;
    
        var screen_height2=screen.height;
        var screen_height=screen_height2-300;
     
        var realHeight = docelement.scrollHeight;
     
              var vi = yWithScroll;
            
        
               if (realHeight < screen_height )
              {
                   
                  $$('.introduction_page')[0].setStyle({height:screen_height +'px'})
                    
               
              }
              else{
         
            
             
              } 
   
    
    }        
   
}


function fix_screen_height_sgc(screen_height_ie,screen_height_mor){

 var browsername=browser_name();
 var browser = navigator.appName;
              if (browser == "Microsoft Internet Explorer"){
   
               var screen_height=screen.height;
               screen_height1=screen_height-150;
              var screen_height_box=screen_height-screen_height_ie;
              height_of_page = document.getElementById('body_id').offsetHeight;
		
              var realHeight = document.getElementById('body_id').offsetHeight;
			
              scro = document.getElementById('body_id').scrollHeight;
			
              off = document.getElementById('body_id').offsetHeight;
			  
             // goff = $('super_parent_id').getHeight();
			
            
              if ( realHeight < screen_height1)
              {
                  $$('.super_main_body_box')[0].setStyle({height:screen_height_box +'px'}) 
                  if($('sgc_page'))
                   { 
                 $('super_main_body_box').style.height='auto'; 
                    } 
					 if( $('create_user_admin'))
                   { 
		
                 $$('.super_main_body_box')[0].setStyle({height:screen_height+80 +'px'}) 
                    } 
           
              }
              else
			
              {
			  	
                      
                  
              }
    }
       else if(browsername =="Safari")
       {

       
        var screen_height=screen.height;
               screen_height1=screen_height-150;
              var screen_height_box=screen_height-screen_height_ie +30;
               
              var realHeight = document.getElementById('body_id').offsetHeight;
              var l=realHeight-150;
              var s=realHeight;
                var hgt=screen_height1-120;
                var report=screen.height+3900;
              scro = document.getElementById('body_id').scrollHeight;
              off = document.getElementById('body_id').offsetHeight;
              goff = $('super_parent_id').getHeight();
            
              if ( realHeight < screen_height1)
                {
     
                  if ($('record') || $('change_id')) 
                  {
                        
                           r=$('record').offsetHeight;
                    
                
                           if(r<1000)
                           { 
                        
                      
                                                               
                           $$('.main_body_box')[0].setStyle({height:hgt +'px'})
                           if($('change_id'))
                           { 
                           $('change_id').style.height=report +'px';
                           }
                            
                          
                     
                  }
                           
                  else{}
                            
                 } 
                
               
                 $$('.main_body')[0].setStyle({height:screen_height_box +'px'})  
               
               
              }
              else 
              
              { 
           

              $$('.main_body')[0].setStyle({height:l +'px'}) 
          
     
              }
              
   
         }
  
    else
    {

 var  yWithScroll = window.innerHeight + window.scrollMaxY;
 var  xWithScroll = window.innerWidth + window.scrollMaxX;
 var w =xWithScroll-30;

   
              var screen_height=screen.height;
              var screen_height_box=screen_height-screen_height_mor;
              height_of_page = document.getElementById('body_id').offsetHeight;
              var realHeight = document.documentElement.scrollHeight
            
              var vi = yWithScroll-90;
               if ( vi < screen_height )
              {
         
                  $$('.super_main_body_box')[0].setStyle({height:vi +'px'})  
              }
              else{
           
              } 
   
    
    }        
   
}

function fix_screen_height_demo(screen_height_ie,screen_height_mor){

 var browser = navigator.appName;
              if (browser == "Microsoft Internet Explorer"){
               var screen_height=screen.height;
               screen_height1=screen_height-150;
              var screen_height_box=screen_height-screen_height_ie;
              height_of_page = document.getElementById('body_id').offsetHeight;
              var realHeight = document.getElementById('body_id').offsetHeight;
              scro = document.getElementById('body_id').scrollHeight;
              off = document.getElementById('body_id').offsetHeight;
              goff = $('super_parent_id').getHeight();
            
              if ( realHeight < screen_height1)
              {
               
                  $$('.super_main_body_box')[0].setStyle({height:screen_height_box +'px'})  
              }
              else
              {
                
              
                  
              }
    }
    else
    {
 var  yWithScroll = window.innerHeight + window.scrollMaxY;
 var  xWithScroll = window.innerWidth + window.scrollMaxX;
 var w =xWithScroll-30;

   
              var screen_height=screen.height;
              var screen_height_box=screen_height-screen_height_mor;
              height_of_page = document.getElementById('body_id').offsetHeight;
              var realHeight = document.documentElement.scrollHeight
            
              var vi = yWithScroll-130;
               if ( vi < screen_height )
              {
         
                  $$('.super_main_body_box')[0].setStyle({height:vi +'px'})  
              }
              else{
           
              } 
   
    
    }        
   
}





function fixing_screen_width_demo(screen_width){
 
   var screen_width=screen.width-screen_width;
        $$('.super_parent_demo')[0].setStyle({width:screen_width +'px'})
   
}

function fix_screen_height_westlbge(screen_height_ie,screen_height_mor){

 var browser = navigator.appName;
              if (browser == "Microsoft Internet Explorer"){
        
               var screen_height=screen.height;
               screen_height1=screen_height-250;
              var screen_height_box=screen_height-screen_height_ie;
              height_of_page = document.getElementById('body_id').offsetHeight;
              var realHeight = document.getElementById('body_id').offsetHeight;
              scro = document.getElementById('body_id').scrollHeight;
              off = document.getElementById('body_id').offsetHeight;
              goff = $('super_parent_id').getHeight();
            
              if ( realHeight < screen_height1)
              {
          
                  $$('.super_main_body_box')[0].setStyle({height:screen_height_box +'px'})  
              }
              else
              {
                
                      
                  
              }
    }
    else
    {
  
 var  yWithScroll = window.innerHeight + window.scrollMaxY;
 var  xWithScroll = window.innerWidth + window.scrollMaxX;
 var w =xWithScroll-30;

   
              var screen_height=screen.height;
              var screen_height_box=screen_height-screen_height_mor;
              height_of_page = document.getElementById('body_id').offsetHeight;
              var realHeight = document.documentElement.scrollHeight
            
              var vi = yWithScroll-260;
               if ( vi < screen_height )
              {
         
                  $$('.super_main_body_box')[0].setStyle({height:vi +'px'})  
              }
              else{
           
              } 
   
    
    }        
   
}
function fixSafariLayout() {
        if ($('record')) {
        var layout = document.getElementById('outter');
        layout.style.height=layout.offsetHeight;
        var left = document.getElementById('content');
        left.style.height=left.offsetHeight;

        }
}

function fix_screen_height(screen_height_ie,screen_height_mor){

 var browsername=browser_name();

 var browser = navigator.appName;
       if (browser == "Microsoft Internet Explorer")
       {

               var screen_height=screen.height;
               screen_height1=screen_height-100;
              var screen_height_box=screen_height-screen_height_ie;
              height_of_page = document.getElementById('body_id').offsetHeight;
              var realHeight = document.getElementById('body_id').offsetHeight;
              scro = document.getElementById('body_id').scrollHeight;
              off = document.getElementById('body_id').offsetHeight;
              goff = $('super_parent_id').getHeight();
             var db=screen.height+430;
            
              if ( realHeight < screen_height1)
              {
                 
             
                     $$('.super_main_body_box')[0].setStyle({height:screen_height_box +'px'})  
                  
                if($('post_reply_id') || $('faq') ||$('dvb_page'))
                   { 
                 $('super_main_body_box').style.height='auto'; 
                    }
                if($('content')){report_height();}
              }
           
              else
              {
                $$('.super_main_body_box')[0].setStyle({height:'auto'});
                   //$('super_main_body_box').style.height='auto';     
                  
              }
    }
    else if(browsername =="Safari")
       {

        var screen_height=screen.height;
        
              var  screen_height1=screen_height-150;
             
              var screen_height_box=screen_height-screen_height_ie +30;

              var realHeight = document.getElementById('body_id').offsetHeight;

              var l=realHeight-150;
 
              var s=realHeight;
    
              var hgt=screen_height1-120;

              scro = document.getElementById('body_id').scrollHeight;
              off = document.getElementById('body_id').offsetHeight;
              /*goff = $('super_parent_id').getHeight();*/
    
              if ( realHeight < screen_height1)
                {

                  if ($('record')) 
                  {
               
                           r=$('record').offsetHeight;

                           if(r<420)
                           { 
                           $$('.main_body_box')[0].setStyle({height:hgt +'px'})
                           }
                           
                           else{}
                            
                 }      
                $$('.main_body')[0].setStyle({height:screen_height_box +'px'})  
  

               
              }
              else 
              
              { 

            if ($('record')) 
                  {

                           r=$('record').offsetHeight;
                            
                           if(r<500)
                           { 
                           $$('.main_body_box')[0].setStyle({height:hgt +'px'})
                           }
                           
                           else{}
                            
                 }      
              $$('.main_body')[0].setStyle({height:l +'px'}) 
          
     
              }
              
   
         }
  
    else
    {

 var  yWithScroll = window.innerHeight + window.scrollMaxY;
 var  xWithScroll = window.innerWidth + window.scrollMaxX;
 var w =xWithScroll-30;
 
   
              var screen_height=screen.height;
              var screen_height_box=screen_height-screen_height_mor;
              height_of_page = document.getElementById('body_id').offsetHeight;
         
           
              var vi = yWithScroll-130;
              var l= yWithScroll-280;
               if ( vi < screen_height )
              {
                
   
                 if ($('post_reply_id')) 
                     {
                    
                     $('super_main_body_box').removeClassName('super_main_body_box'); 
                     
                    } 
    
                    else
                    {
                  
                
                          $$('.super_main_body_box')[0].setStyle({height:vi +'px'})
                       if($('annual_record'))
                            {
                            $('super_main_body_box').style.height='auto';     
                            }

                    } 
					
              }
              else
              {
                 
              } 
   
    
    }        
   
}

function calyon_page()
{
	 var browsername=browser_name();

var browser = navigator.appName;
	 if(browsername =="Firefox" || browser == "Microsoft Internet Explorer")
	 {
	
	 right_side_height = document.getElementById('right_side').offsetHeight;
	 correct_height= right_side_height+50;	
	
	 if(right_side_height>=678)
	 {
	 
	 	   $$('.super_main_body_box')[0].setStyle({height:correct_height +'px'})
	 }
	 }
}


function report_height_jb(){ 

    var browsername=browser_name();
    var screen_height=screen.height;
    var  screen_height1=screen_height-300;
    var browser = navigator.appName;
    var test=document.getElementById('content').offsetHeight;
    var scro=document.getElementById('body_id').scrollHeight;
    var l=scro-100;
             if (browser == "Microsoft Internet Explorer" || browsername=="Firefox")
             {
                    if(test>500)
                    {
                    
                    $('super_main_id').style.height='auto';
                    }
                    
                     else
                     {
                    
                       $('super_main_id').style.height= screen_height1 +'px';  
                     
                      } 
        
             
             }

             else if(browsername =="Safari")
              {
              
               $('super_main_id').style.height=l +'px';
              
              } 
              else
              {
              
              }
}

function report_height()
{ 

    var browsername=browser_name();
    var screen_height=screen.height;
    var  screen_height1=screen_height-320;
    var browser = navigator.appName;
    var test=document.getElementById('content').offsetHeight;
    var scro=document.getElementById('body_id').scrollHeight;
    var l=scro-100;
  
     if (browser == "Microsoft Internet Explorer" || browsername=="Firefox")
     {
            if(test>500)
            {
           
            $('super_main_body_box').style.height='auto';
      
            }
            
             else
             {
        
               $('super_main_body_box').style.height= screen_height1 +'px';  
             
              } 

     
     }

     else if(browsername =="Safari")
      {
      
       $('super_main_body_box').style.height=l +'px';
      
      } 
      else
      {
      
      }
}



function fix_screen_height_adviser(screen_height_ie,screen_height_mor){

 var browsername=browser_name();


 var browser = navigator.appName;
       if (browser == "Microsoft Internet Explorer")
       {

               var screen_height=screen.height;
               screen_height1=screen_height-100;
   
              var screen_height_box=screen_height-screen_height_ie;
           
              height_of_page = document.getElementById('body_id').offsetHeight;
          
              var realHeight = document.getElementById('body_id').offsetHeight;
            
              scro = document.getElementById('body_id').scrollHeight;
   
              off = document.getElementById('body_id').offsetHeight;
            
              goff = $('super_parent_id').getHeight();
      
              if ( realHeight < screen_height1)
              {
        
                     $$('.super_main_body_box')[0].setStyle({height:screen_height_box +'px'})  
                  
               
               
              }
           
              else
              {
              
                   $$('.super_main_body_box')[0].setStyle({height:'auto'});
                   //$('super_main_body_box').style.height='auto';     
                  
                  
              }
    }
    else if(browsername =="Safari")
       {

        var screen_height=screen.height;
        
              var  screen_height1=screen_height-150;
             
              var screen_height_box=screen_height-screen_height_ie +30;

              var realHeight = document.getElementById('body_id').offsetHeight;

              var l=realHeight-150;
 
              var s=realHeight;
    
              var hgt=screen_height1-120;

              scro = document.getElementById('body_id').scrollHeight;
              off = document.getElementById('body_id').offsetHeight;
              /*goff = $('super_parent_id').getHeight();*/
    
              if ( realHeight < screen_height1)
                {

                  if ($('record')) 
                  {
               
                           r=$('record').offsetHeight;

                           if(r<420)
                           { 
                           $$('.main_body_box')[0].setStyle({height:hgt +'px'})
                           }
                           
                           else{}
                            
                 }      
                $$('.main_body')[0].setStyle({height:screen_height_box +'px'})  
  

               
              }
              else 
              
              { 

            if ($('record')) 
                  {

                           r=$('record').offsetHeight;
                            
                           if(r<500)
                           { 
                           $$('.main_body_box')[0].setStyle({height:hgt +'px'})
                           }
                           
                           else{}
                            
                 }      
              $$('.main_body')[0].setStyle({height:l +'px'}) 
          
     
              }
              
   
         }
  
    else
    {

 var  yWithScroll = window.innerHeight + window.scrollMaxY;
 var  xWithScroll = window.innerWidth + window.scrollMaxX;
 var w =xWithScroll-30;
 
   
              var screen_height=screen.height;
              var screen_height_box=screen_height-screen_height_mor;
              height_of_page = document.getElementById('body_id').offsetHeight;
         
           
              var vi = yWithScroll-280;
      
               if ( vi < screen_height )
              {
                 
   
          $$('.super_main_body_box')[0].setStyle({height:vi +'px'})

                  
              }
              else
              {
                          
              } 
   
    
    }        
   
}
function height_fix()
{

  var realHeight = document.getElementById('body_id').offsetHeight;
  var main=$('main_id').offsetHeight;
  var set_height=realHeight+150;
  var l=screen.height+150;

 if(main<=300)
   {

    $$('.main_body')[0].setStyle({height:screen.height +'px'})
   
   }
  else
   {
   $$('.main_body')[0].setStyle({height:set_height +'px'})
   }

}
function fix_screen_width(screen_width){

   var screen_width=screen.width-screen_width;
        $$('.super_parent')[0].setStyle({width:screen_width +'px'})
   
}
function browser_name(){
var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			   string: navigator.userAgent,
			   subString: "iPhone",
			   identity: "iPhone/iPod"
	    },
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();

return (BrowserDetect.browser);
}

function fixing_screen_width(screen_width){
  
   var screen_width=screen.width-screen_width;
        $$('.super_parent')[0].setStyle({width:screen_width +'px'})
   
}

 
 
   
function fixing_screen_height(screen_height_ie,screen_height_mor){
 var browsername=browser_name();
 var browser = navigator.appName;
              if (browser == "Microsoft Internet Explorer"){
             
              var screen_height=screen.height;
              var screen_height_box=screen_height-screen_height_ie;
              height_of_page = document.getElementById('body_id').offsetHeight;
              var realHeight = document.getElementById('body_id').offsetHeight;
              
              if ( realHeight < screen_height)
              {
                
         
                  $$('.super_main_body_box')[0].setStyle({height:screen_height_box +'px'}) 
                  if($('post_reply_id'))
                   { 
                       
                 $('super_main_id').style.height='auto'; 
                    } 
                
              }
              else
              {
                
              
                  
              }
              }
   else if(browsername =="Safari")
       {

        var screen_height=screen.height;
        
              var  screen_height1=screen_height-150;
             
              var screen_height_box=screen_height-screen_height_ie +30;

              var realHeight = document.getElementById('body_id').offsetHeight;

              var l=realHeight-150;
 
              var s=realHeight;
    
              var hgt=screen_height1-120;

              scro = document.getElementById('body_id').scrollHeight;
              off = document.getElementById('body_id').offsetHeight;
              /*goff = $('super_parent_id').getHeight();*/
    
              if ( realHeight < screen_height1)
                {
                        
     
                  if ($('record')) 
                  {
            
                           r=$('record').offsetHeight;
                                                       
                           if(r<400)
                           { 
                           $$('.main_body_box')[0].setStyle({height:hgt +'px'})
                           }
                           
                           else{}
                            
                 }     
                 if($('report'))
                 {
       
                  $('super_main_id').style.height=hgt +'px'; 
              
                 } 
                $$('.main_body')[0].setStyle({height:screen_height_box +'px'})  
  

               
              }
              else 
              
              { 

            if ($('record')) 
                  {
                        g=$('report').offsetHeight;
                  
                           r=$('record').offsetHeight;
                
                           if(r<500)
                           { 
                           $$('.main_body_box')[0].setStyle({height:hgt +'px'})
                           }
                           
                           else{}
                            
                 }      
              $$('.main_body')[0].setStyle({height:l +'px'}) 
          
     
              }
              
   
         }
  
            
   else
    {
 var  yWithScroll = window.innerHeight + window.scrollMaxY;
 var  xWithScroll = window.innerWidth + window.scrollMaxX;
 var w =xWithScroll-30;

   
              var screen_height=screen.height;
              var screen_height_box=screen_height-screen_height_mor;
              height_of_page = document.getElementById('body_id').offsetHeight;
              var realHeight = document.documentElement.scrollHeight
            
              var vi = yWithScroll-130;
               if ( vi < screen_height )
              {
		 		if($$('.super_main_body_box') && $$('.super_main_body_box')[0])$$('.super_main_body_box')[0].setStyle({height:vi +'px'})  
              }
              else{
           
              } 
   
    
    }        
   

}
function fix_screen_height_westlb(screen_height_ie,screen_height_mor){
 var browsername=browser_name();
 var browser = navigator.appName;
              if (browser == "Microsoft Internet Explorer"){
         
               var screen_height=screen.height;
               screen_height1=screen_height-150;
              var screen_height_box=screen_height-screen_height_ie;
              height_of_page = document.getElementById('body_id').offsetHeight;
              var realHeight = document.getElementById('body_id').offsetHeight;
              scro = document.getElementById('body_id').scrollHeight;
              off = document.getElementById('body_id').offsetHeight;
              goff = $('super_parent_id').getHeight();
                      var hgt=screen_height1-120;
              if ( realHeight < screen_height1)
              {
              $$('.super_main_body_box')[0].setStyle({height:screen_height_box +'px'})  
          if ($('box1') || $('box2')||$('box3')) 
                  {
                 $$('.super_main_body_box')[0].setStyle({height:'auto'})        
                 }      
                  
              }
              else
              {
        
                      
                  
              }
    }
     else if(browsername =="Safari")
       {

        var screen_height=screen.height;
        
              var  screen_height1=screen_height-150;
             
              var screen_height_box=screen_height-screen_height_ie +30;

              var realHeight = document.getElementById('body_id').offsetHeight;

              var l=realHeight-150;
 
              var s=realHeight;
    
              var hgt=screen_height1-120;
        
              scro = document.getElementById('body_id').scrollHeight;
              off = document.getElementById('body_id').offsetHeight;
              /*goff = $('super_parent_id').getHeight();*/
    
              if ( realHeight < screen_height1)
                {
      
                  if ($('record') || $('main_box_content') ||$('report_result')) 
                  {
                           r=$('record').offsetHeight;
                     
                           
                           
                           if(r<500 )
                           { 
                             $$('.main_box')[0].setStyle({height:hgt +'px'})
                           $$('.main_body_box')[0].setStyle({height:hgt +'px'})
                          
                           }
                           
                           else
                           {
                           
                           if ($('report_result'))
                             {
                     $$('.show_user')[0].setStyle({height:hgt +'px'})
                             }}
                            
                 }      
                $$('.main_body')[0].setStyle({height:screen_height_box +'px'})  
  

               
              }
              else 
              
              { 

            if ($('record')) 
                  {
          
                           r=$('record').offsetHeight;
                
                           if(r<500)
                           { 
                           $$('.main_body_box')[0].setStyle({height:hgt +'px'})
                           }
                           
                           else
                           {
                              
                           }
                            
                 }      
              $$('.main_body')[0].setStyle({height:l +'px'}) 
          
     
              }
              
   
         }
  
    else
    {
 var  yWithScroll = window.innerHeight + window.scrollMaxY;
 var  xWithScroll = window.innerWidth + window.scrollMaxX;
 var w =xWithScroll-30;

           
              var screen_height=screen.height;
              var screen_height_box=screen_height-screen_height_mor;
              height_of_page = document.getElementById('body_id').offsetHeight;
              var realHeight = document.documentElement.scrollHeight
              var hgt=screen_height-120;
              var vi = yWithScroll-100;
               if ( vi < screen_height )
              {
              $('super_main_body_box').style.height=vi +'px';  
                if ($('record') || $('main_box_content')) 
                  {
                           r=$('record').offsetHeight;
                     
                           
                           
                           if(r<500 )
                           { 
                         
                             $('super_main_body_box').style.height=hgt  +'px';  
                          
                           }
                           
                           
                            
                 }      
               
              }
              else{
      
              } 
   
    
    }        
   
}

function place_cursor(){

    if (document.forms.length != 0) {
        for (var z = 0; z <= document.forms[0].elements.length; z++) {
            if (document.forms[0].elements[z].type == 'hidden') {
                continue;
            }
            else {
                document.forms[0].elements[z].focus();
                break;
                
            }
        }
    }
}

function change_class_name(){
    $('id_main_body').removeClassName('main_body_box');
    $('id_main_body').addClassName('main_body');
    
}

function change_language_value(user_value, host){
    if (user_value == "English") {
        var eng_url = "/westlben/login";
        window.location.href = eng_url;
    }
    else 
        if (user_value == "German") {
            var eng_url = "/westlbge/login";
            window.location.href = eng_url;
        }
        else 
            if (user_value == "New York" || user_value == "Canada" ) {
                window.location.href = "/sgcnewyork/login";
            }
            else 
                if (user_value == "Asia") {
                    window.location.href = "/sgcasia/login";
                }
                else 
                    if (user_value == "Paris") {
                        window.location.href = "/sgcparis/login";
                    }
                    else {
                        return;
                    }
}

function reSizeWindow(info_height)
{
    
       if(!info_height)
       {
        info_height=340
       }
    
    var browser = navigator.appName;
    var sereen_height = screen.height;

 
    if (browser == "Microsoft Internet Explorer") {
        try 
        {
            
            var oBody = iframe_id.document.body;

            var oFrame = document.all("iframe_id");
            
          
             oFrame.style.height = oBody.scrollHeight + (oBody.offsetHeight - oBody.clientHeight);
            var height_of_pages = oFrame.style.height;
            
             var screen_height2=screen.height;
            var vertual_height = screen_height2-info_height;
            height_of_pages=parseInt(height_of_pages.replace("px",""));
            if(height_of_pages < vertual_height)
            {
                oFrame.style.height = vertual_height;
                oFrame.style.width = oBody.scrollWidth + (oBody.offsetWidth - oBody.clientWidth);
                //oFrame.$('content_background_div').style.height = vertual_height;
            }
            else
            {
                oFrame.style.height = oBody.scrollHeight + (oBody.offsetHeight - oBody.clientHeight);
                oFrame.style.width = oBody.scrollWidth + (oBody.offsetWidth - oBody.clientWidth);
                //oFrame.$('content_background_div').style.height = oBody.scrollHeight + (oBody.offsetHeight - oBody.clientHeight);
            }
        } 
        //An error is raised if the IFrame domain != its container's domain
       catch (e) 
        {
            window.status = 'Error: ' + e.number + '; ' + e.description;
        }
    }
    else {
         var realHeight = $('iframe_id').contentWindow.document.body.offsetHeight;
        // alert(" Real Height "+realHeight);
         var screen_height2=screen.height;
         var height_of_pages = realHeight;
         var vertual_height = screen_height2-370;
        $('iframe_id').style.height = realHeight + 'px';
        
         if(realHeight < vertual_height){
           $('iframe_id').style.height = vertual_height + 'px';
            //alert("height_of_pages "+realHeight+" vertual_height "+vertual_height);
            }
         else{
           $('iframe_id').style.height = realHeight + 20 + 'px';
           //alert($('iframe_id').style.height);
         }
    }
}




function showResultDimensions_iframe(){
    var browser = navigator.appName;
    
    if (browser == "Microsoft Internet Explorer") {
        var realHeight = $('iframe_id').contentWindow.document.body.offsetHeight;
        var k = $('iframe_id').scrollHeight;
        
        $('iframe_id').style.height = realHeight + 200 + k + 'px';
    }
    else {
        var realHeight = $('iframe_id').contentWindow.document.body.offsetHeight;
        $('iframe_id').style.height = realHeight + 100 + 'px';
    }
}

function course_report(host_name,from){
	if(from == 'from_westlben')
	{
    $('compliance').action = host_name + "/user/course_report_westlbge"
    $('compliance').submit();
	}
	else if(from =='from_westlbge')
	{
	$('compliance').action = host_name + "/user/course_report_westlben"
    $('compliance').submit();
	}
	else
	{
		 $('compliance').action = host_name + "/user/course_report"
    $('compliance').submit();
	}
}

function user_report(host_name,from){
	if(from=='from_westlben')
	{
    $('compliance').action = host_name + "/user/specific_user_london_westlbge"
    $('compliance').submit();
	}
	else if(from=='from_westlbge')
	{
    $('compliance').action = host_name + "/user/specific_user_london_westlben"
    $('compliance').submit();
	}
	else
	{
    $('compliance').action = host_name + "/user/specific_user_london"
    $('compliance').submit();
	}
}

function login_index(corporate){
    document.forms[0].action = corporate + "/login/"
    document.forms[0].submit();
}

function assign_fides_course(fides_name,host_name){
	var status = confirm("You have selected " + fides_name + " .Please note that you cannot alter your perference at the later date.Click 'OK' to continue or 'Cancel' to alter your selection now");
    if (status == true) {
		$('myform').action = host_name+'/user/assign_fides_course_calyon_london'
		$('myform').submit();
	}
}

function assign_modules_specifc_course(host_name){
    $('form_for_modules').action = host_name + "/user/dashboard_display_juliusbaer_specific_course"
    $('form_for_modules').submit();
}


function confirm_password(host_name){
    $('form').action = host_name + "/user/index"
    $('form').submit();
}



function cancel_add_question(url, c_id, lpc_id){
    document.forms[0].action = url+"?course_id=" + c_id + "&pc_id=" + lpc_id + "&from=forum_index"
    document.forms[0].submit();
}


function cancel_post(host_name, c_id, lpc_id){
    document.forms[0].action = host_name + "/user/display_post?course_id=" + c_id + "&pc_id=" + lpc_id + "&from=forum_index"
    document.forms[0].submit();
}

function cancel_forum_reply(host_name, m_id, q_id){
    document.forms[0].action = host_name + "/forum/reply?mod_id=" + m_id + "&forum_question_id=" + q_id
    document.forms[0].submit();
}

function enquiry_cancel(){
    document.forms[0].action = "/training/enquiry_form"
    document.forms[0].submit();
}

function rbc_cancel(){
    document.forms[0].action = "/login/rbc_registration"
    document.forms[0].submit();
}

function rbc_exit(){
    document.forms[0].action = "/login"
    document.forms[0].submit();
    window.close();
}


function reset_newyork(location){
    document.forms[0].action = "/login/new_requst_access/" + "?" + "location_id=" + location
    
    document.forms[0].submit();
    
}


function access_activation(id){
    document.forms[0].action = "/user/access_activation/" + id
    document.forms[0].submit();
    pause(2000);
    window.opener.location.reload();
}


function access_deactivation(id){
    document.forms[0].action = "/user/access_deactivation/" + id
    document.forms[0].submit();
    pause(2000);
    window.opener.location.reload();
}

function approve_user(){
    $('approve').action = '/user/send_email_to_user'
    $('approve').target = '_blank'
    $('approve').submit();
}

function access_cancel(){
    window.close();
}

function close_window(){
    document.forms[0].action = "/user/search_user_juliusbaer"
    document.forms[0].submit();
    window.close();
}



function password_send(user_id){
    document.forms[0].action = "/user/reset_password_send/" + user_id
    document.forms[0].submit();
}

// submitcount variable defined above
function check_submit_count(user_id){
     if (submitcount == 0){
            submitcount++;
            return password_send(user_id);
      }else{
            alert("Your request is being submitted, Please wait!. Thanks!");
            return false;
      }
}

function save_and_exit_assessment_test(expiry_date, host_name){
    var status = confirm("This will save your current test progress and close this session.You have till " + expiry_date + " to complete this test.After that,your test attempt will be invalidated and you will have to start over.Click OK to save and exit the Test. or cancel to return to the Assessment Test");
    if (status == true) {
        $('sample').action = host_name + '/user/save_and_exit_assessment_test'
        $('sample').submit();
    }
    
}

function skip_assessment_test(){
    $('sample').action = '/user/skip_assessment_test_juliusbaer'
    $('sample').submit();
}

function preview_email(host_name){
    var target = document.getElementById("preview");
    target.setAttribute("target", "popup");
    target.setAttribute("action", "/user/email_format_preview");
    OpenWin = this.open("preview", "popup", "toolbar=no,menu=no,resizable=no,scrollbars=yes, status=no,width=600,height=550,top=100,left=100");
    target.submit();
}

function preview_reminder_email(host,from)
{
	if ($('template_id').value == "") {
		alert('Please select an Email Template.');
	}
	else {
		if (from == 'preview') {
			var target = document.getElementById("preview");
			var email_id = $('template_id').value;
			$('email_template').value = email_id;
			target.setAttribute("target", "popup");
			target.setAttribute("action", "/user/preview_partial_page");
			OpenWin = this.open("preview", "popup", "toolbar=no,menu=no,resizable=no,scrollbars=yes,status=no,width=600,height=550,top=100,left=100");
			target.submit();
			
		}
		else {
		target = document.getElementById("preview");
			target.removeAttribute("target");
			$('preview').action = host + '/user/send_reminder'
			$('preview').submit();
		}
	}
}

function check_length()
{
	var email_length = $('user_emails').value.split(',')
	$('email_length').value = email_length.length;
}


function send_email_juliusbaer(host_name){
    if (confirm("Are you sure to continue to send emails.")) {
        var target = document.getElementById("preview");
        target.removeAttribute("target");
        $('preview').action = host_name + '/user/send_emails_message'
        $('preview').submit();
    }
}

function checkedAll_westlben(){
    if (checked == false) {
        checked = true
    }
    else {
        checked = false
    }
    for (var i = 0; i < document.getElementById('view_list_user').elements.length; i++) {
        document.getElementById('view_list_user').elements[i].checked = checked;
    }
}


function submit_view_list(host_name){
    var l = $('view_list_user').elements.length
    
    var test = 0
    
    for (i = 0; i < l; i++) {
        if ($('view_list_user').elements[i].type == 'checkbox' && $('view_list_user').elements[i].checked == true) {
            test += 1
        }
    }
    if (test == 0) {
        alert("Please Select Atleast one checkbox");
		return false;
    }
    else {
		var form_ele_length = $$('form#view_list_user>table>tbody>tr').length 
        if(form_ele_length == 2)
		{
		alert("No Users Found");
		return false;
		}
			else
	{
        $('view_list_user').action = host_name + "/user/send_mail_to_user_westlben"
        $('view_list_user').submit();
    }
	}
}

function approve_user(req_id){
    var status = "approve";
    $('approve').action = '/user/send_approve_to_user_message?req_id=' + req_id + "&status_id=" + status
    $('approve').target = '_blank'
    $('approve').submit();
}

function reject_user(req_id){
    var status = "reject";
    $('approve').action = '/user/send_approve_to_user_message?req_id=' + req_id + "&status_id=" + status
    $('approve').target = '_blank'
    $('approve').submit();
}

function all_daw_lp_report(host_name){
    $('all_daw').action = host_name + "/user/uda_assigned_users"
    $('all_daw').submit()
}

function all_uda_lp_report(host_name){
    $('all_uda').action = host_name + "/user/uda_assigned_users"
    $('all_uda').submit();
}


function all_mar_lp_report(host_name){
    $('all_mar').action = host_name+"/user/uda_assigned_users" 
    $('all_mar').submit()
}

function all_fides_lp_report(host_name){
    $('all_fides').action = host_name+"/user/uda_assigned_users" 
    $('all_fides').submit()
}


function all_bcp_lp_report(host_name){
    $('all_bcp').action = host_name+"/user/uda_assigned_users" 
    $('all_bcp').submit()
}


function completed_uda_lp_report(host_name){
	$('course').value ="uda"
    $('all_uda').action = host_name + "/user/completed_uda_policy_training"
    $('all_uda').submit();
	
}

function completed_mar_lp_report(host_name){
	$('course').value ="mar"
    $('all_uda').action = host_name + "/user/completed_uda_policy_training"
    $('all_uda').submit();
	
}

function completed_daw_lp_report(host_name){
	$('course').value ="daw"
    $('all_uda').action = host_name + "/user/completed_uda_policy_training"
    $('all_uda').submit();
	
}



function learning_uda_policy_report(host_name){
    $('lp_uda_rep').action = host_name + "/user/uda_assigned_users?" + "course=uda"
    $('lp_uda_rep').submit()
}

checked = false;
function checkedAll(){
    if (checked == false) {
        checked = true
    }
    else {
        checked = false
    }
    for (var i = 0; i < document.getElementById('emaillist').elements.length; i++) {
        document.getElementById('emaillist').elements[i].checked = checked;
    }
}

function checkedmodule(module_id){
    if (checked == false) {
        checked = true
    }
    else {
        checked = false
    }
    for (var i = 0; i < document.getElementById(module_id).elements.length; i++) {
        document.getElementById(module_id).elements[i].checked = checked;
    }
    
}

//function addAll(group, action)
//{
// for (var i=0; i<group.length; i++)
//  group[i].checked = action;
//}


function addEmail(all_user)
{

    if (!document.emaillist.emails) return;
    var cemails = "";
	//found_emails=new Array();
	
	if (document.emaillist.emails.length) 
	{
        for (i = 0; i < document.emaillist.emails.length; i++) {
            if (document.emaillist.emails[i].checked || all_user) {
    			
				// found_emails.push(document.emaillist.emails.value)
				 
                if (cemails.length > 0) cemails += ",";
                cemails += document.emaillist.emails[i].value
				
            }
        }
    }
    else 
	{
        if (document.emaillist.emails.checked || all_user) 
		{
            //found_emails.push(document.emaillist.emails.value)
            cemails = document.emaillist.emails.value
        }
        
    }
	
	
    if (cemails.length>0) 
	{
		existing_email=opener.document.form_emails.email_select.value;
		
		if(existing_email.length>0)existing_email+=","
		
        opener.document.form_emails.email_select.value = existing_email+cemails;
        window.close();
    }
    else {
        alert("No record selectd!");
    }
}



function unmark(id){
    document.forms[0].action = "/user/unread/" + id
    document.forms[0].submit();
    window.opener.location.reload();
    window.close();
}

function search_based_email_user(host_name){
    var target = document.getElementById("preview");
    target.removeAttribute("target");
    $('preview').action = host_name + "/user/email_users_main?sort_user_by=" + "search_based"
    $('preview').submit();
}

function rollout_groups_users(host_name){
    $('rollout').action = host_name + "/user/view_list_users_westlben"
    $('rollout').submit();
}

//For Discussion report admin // Added By Ganesh // Start
function discuss_report(host_name){
    $('report').action = host_name + "/user/discussion_forum_admin"
    $('report').submit();
}

//For Discussion report admin // Added By Ganesh // End 

//For Learning report  // Added By Ganesh // Start
function lp_report_type(host_name){
    $('report').action = host_name + "/user/lp_report_type"
    $('report').submit();
}

//For Learning report  // Added By Ganesh // End

//For Learning report  // Added By Ganesh // Start

//for  juliusbaer start/////
function learning_reports(host_name){
    $('report').action = host_name + "/user/learning_reports"
    $('report').submit();
}

//For Learning report  // Added By Ganesh // End

function check_fields_user(host_name){
   if ($('user_firstname').value == "" && $('user_lastname').value == "" && $('user_email').value == "") {
       alert("Please provide atleast one value");
       return false;
   }
} 


function check_fields_user_mourant(host_name){
    if ($('user_firstname').value == "" && $('user_lastname').value == "" && $('user_email').value == "") {
        alert("Please provide atleast one value")
    }
    else {
        $('user_report').action = host_name + "/user/specific_user_report_westlb"
        $('user_report').submit();
    }
}



function check_fields_user_juliusbaer(host_name){
    if ($('user_firstname').value == "" && $('user_lastname').value == "" && $('user_email').value == "") {
        alert("Please provide atleast one value")
    }
    else {
        $('user_report').action = host_name + "/user/user_report"
        $('user_report').submit();
    }
}

function user_view_juliusbaer(host_name){
    $('report').action = host_name + "/user/user_view_report_julius"
    $('report').submit();
}

function company_view_juliusbaer(host_name){
    $('report').action = host_name + "/user/company_view_report_julius"
    $('report').submit();
}

function customize_report_juliusbaer(host_name){
    $('report').action = host_name + "/user/compaliance_search_report"
    $('report').submit();
}

function course_specific_juliusbaer(host_name){
    $('report').action = host_name + "/user/generate_report_course_specific_juliusbaer"
    $('report').submit();
}

function user_specific_juliusbaer(host_name){
    $('report').action = host_name + "/user/generate_report_specific_user"
    $('report').submit();
}

function advanced_report_juliusbaer(host_name){
    $('report').action = host_name + "/user/reports"
    $('report').submit();
}

function email_users_juliusbaer(host_name){
    $('report').action = host_name + "/user/email_users"
    $('report').submit();
}

function email_all_user_juliusbaer(host_name){
    $('report').action = host_name + "/user/email_registered_user"
    $('report').submit();
}

function email_based_on_search_juliusbaer(host_name){
    $('report').action = host_name + "/user/email_users_main"
    $('report').submit();
}

function view_template_juliusbaer(host_name){
    $('report').action = host_name + "/user/view_templates"
    $('report').submit();
}

function add_view_details_juliusbaer(host_name){
    $('report').action = host_name + "/user/batch_details_final_assessment_juliusbaer"
    $('report').submit();
}

function assign_final_assignment_test_select_user(host_name){
    $('report').action = host_name + "/user/assign_final_assignment_test_to_selected_user"
    $('report').submit();
}

function view_and_email_reg_number_juliusbaer(host_name){
    $('report').action = host_name + "/user/view_and_email_test_registration_number"
    $('report').submit();
}


function email_all_user(host_name){
    $('report').action = host_name + "/user/email_formats_send?" + 'flag=for_user_email'
    $('report').submit();
}

function assignment_test_juliusbaer(host_name){
    $('report').action = host_name + "/user/final_assessment_test_juliusbaer"
    $('report').submit();
}

function search_user_juliusbaer(host_name){
    $('report').action = host_name + "/user/search_user_set_notification"
    $('report').submit();
}

/////////////////////////Advance report juliusbaer/////////////////////////////////////////
function value_check_advance_report(){
    if (($('phases1').value == 'Module Progress') || ($('phases1').value == 'Test Score') || ($('phases1').value == 'Time Spent(Module)') || ($('phases1').value == 'Time Spent(Test)')) {
        if (isNaN($('user_select1').value)) {
            alert('Please enter a numeric value');
            return false;
        }
    }
    else 
        if (($('phases1').value == 'Test Date') || ($('phases1').value == 'Activation Date')) {
            $('user_select1').value = $('user_select1').value.replace("/", "-");
            dmy = $('user_select1').value.split("-");
            
            if (('' + parseInt(dmy[0]) == 'NaN' || '' + parseInt(dmy[1]) == 'NaN' || '' + parseInt(dmy[2]) == 'NaN') || (dmy[0].length != 2 || dmy[0] < 1 || dmy[0] > 31) || (dmy[1].length != 2 || dmy[1] < 1 || dmy[1] > 12) || (dmy[2].length != 4 || dmy[2] < 1980 || dmy[2] > 2080)) {
                alert("Please enter a valid date.\n (e.g. 01-03-2006 in place of  March 1, 2006)");
                $('user_select1').focus();
                return false;
            }
            
        }
    
    
    if (($('phases2').value == 'Module Progress') || ($('phases2').value == 'Test Score') || ($('phases2').value == 'Time Spent(Module)') || ($('phases2').value == 'Time Spent(Test)')) {
        if (isNaN($('user_select2').value)) {
            alert('Please enter a numeric value');
            return false;
        }
    }
    else 
        if (($('phases2').value == 'Test Date') || ($('phases2').value == 'Activation Date')) {
            $('user_select2').value = $('user_select2').value.replace("/", "-");
            dmy = $('user_select2').value.split("-");
            
            if (('' + parseInt(dmy[0]) == 'NaN' || '' + parseInt(dmy[1]) == 'NaN' || '' + parseInt(dmy[2]) == 'NaN') || (dmy[0].length != 2 || dmy[0] < 1 || dmy[0] > 31) || (dmy[1].length != 2 || dmy[1] < 1 || dmy[1] > 12) || (dmy[2].length != 4 || dmy[2] < 1980 || dmy[2] > 2080)) {
                alert("Please enter a valid date.\n (e.g. 01-03-2006 in place of  March 1, 2006)");
                $('user_select2').focus();
                return false;
            }
            
        }
    
    if (($('phases3').value == 'Module Progress') || ($('phases3').value == 'Test Score') || ($('phases3').value == 'Time Spent(Module)') || ($('phases3').value == 'Time Spent(Test)')) {
        if (isNaN($('user_select3').value)) {
            alert('Please enter a numeric value');
            return false;
        }
    }
    else 
        if (($('phases3').value == 'Test Date') || ($('phases1').value == 'Activation Date')) {
            $('user_select3').value = $('user_select3').value.replace("/", "-");
            dmy = $('user_select3').value.split("-");
            
            if (('' + parseInt(dmy[0]) == 'NaN' || '' + parseInt(dmy[1]) == 'NaN' || '' + parseInt(dmy[2]) == 'NaN') || (dmy[0].length != 2 || dmy[0] < 1 || dmy[0] > 31) || (dmy[1].length != 2 || dmy[1] < 1 || dmy[1] > 12) || (dmy[2].length != 4 || dmy[2] < 1980 || dmy[2] > 2080)) {
                alert("Please enter a valid date.\n (e.g. 01-03-2006 in place of  March 1, 2006)");
                $('user_select3').focus();
                return false;
            }
            
        }
    
    if (($('phases4').value == 'Module Progress') || ($('phases4').value == 'Test Score') || ($('phases4').value == 'Time Spent(Module)') || ($('phases4').value == 'Time Spent(Test)')) {
		if (isNaN($('user_select4').value)) {
			alert('Please enter a numeric value');
			return false;
		}
	}
	else 
		if (($('phases4').value == 'Test Date') || ($('phases4').value == 'Activation Date')) {
			$('user_select4').value = $('user_select4').value.replace("/", "-");
			dmy = $('user_select4').value.split("-");
			
			if (('' + parseInt(dmy[0]) == 'NaN' || '' + parseInt(dmy[1]) == 'NaN' || '' + parseInt(dmy[2]) == 'NaN') || (dmy[0].length != 2 || dmy[0] < 1 || dmy[0] > 31) || (dmy[1].length != 2 || dmy[1] < 1 || dmy[1] > 12) || (dmy[2].length != 4 || dmy[2] < 1980 || dmy[2] > 2080)) {
				alert("Please enter a valid date.\n (e.g. 01-03-2006 in place of  March 1, 2006)");
				$('user_select4').focus();
				return false;
			}
			
		}
		else {
			Element.hide('edit_query');
			if ($('back_to_hide')) Element.hide('back_to_hide');
		}
    
}

///////////////////////////////////////////////////Advance report juliusbaer END///////////////////////////
/////////////Advance report newyork Start///////////////////////////////////////////////////////////////////
function value_check_sgcnewyork_advance_report(){
    if (($('phases1').value == 'Module Progress') || ($('phases1').value == 'Test Score') || ($('phases1').value == 'Time Spent(Module)') || ($('phases1').value == 'Time Spent(Test)')) {
        if (isNaN($('user_select1').value)) {
            alert('Please enter a numeric value');
            return false;
        }
    }
    else 
        if (($('phases1').value == 'Test Date') || ($('phases1').value == 'Activation Date')) {
            $('user_select1').value = $('user_select1').value.replace("/", "-");
            dmy = $('user_select1').value.split("-");
            
            if (('' + parseInt(dmy[0]) == 'NaN' || '' + parseInt(dmy[1]) == 'NaN' || '' + parseInt(dmy[2]) == 'NaN') || (dmy[0].length != 2 || dmy[0] < 1 || dmy[0] > 31) || (dmy[1].length != 2 || dmy[1] < 1 || dmy[1] > 12) || (dmy[2].length != 4 || dmy[2] < 1980 || dmy[2] > 2080)) {
                alert("Please enter a valid date.\n (e.g. 01-03-2006 in place of  March 1, 2006)");
                $('user_select1').focus();
                return false;
            }
            
        }
    
    
    if (($('phases2').value == 'Module Progress') || ($('phases2').value == 'Test Score') || ($('phases2').value == 'Time Spent(Module)') || ($('phases2').value == 'Time Spent(Test)')) {
        if (isNaN($('user_select2').value)) {
            alert('Please enter a numeric value');
            return false;
        }
    }
    else 
        if (($('phases2').value == 'Test Date') || ($('phases2').value == 'Activation Date')) {
            $('user_select2').value = $('user_select2').value.replace("/", "-");
            dmy = $('user_select2').value.split("-");
            
            if (('' + parseInt(dmy[0]) == 'NaN' || '' + parseInt(dmy[1]) == 'NaN' || '' + parseInt(dmy[2]) == 'NaN') || (dmy[0].length != 2 || dmy[0] < 1 || dmy[0] > 31) || (dmy[1].length != 2 || dmy[1] < 1 || dmy[1] > 12) || (dmy[2].length != 4 || dmy[2] < 1980 || dmy[2] > 2080)) {
                alert("Please enter a valid date.\n (e.g. 01-03-2006 in place of  March 1, 2006)");
                $('user_select2').focus();
                return false;
            }
            
        }
    
    if (($('phases3').value == 'Module Progress') || ($('phases3').value == 'Test Score') || ($('phases3').value == 'Time Spent(Module)') || ($('phases3').value == 'Time Spent(Test)')) {
        if (isNaN($('user_select3').value)) {
            alert('Please enter a numeric value');
            return false;
        }
    }
    else 
        if (($('phases3').value == 'Test Date') || ($('phases1').value == 'Activation Date')) {
            $('user_select3').value = $('user_select3').value.replace("/", "-");
            dmy = $('user_select3').value.split("-");
            
            if (('' + parseInt(dmy[0]) == 'NaN' || '' + parseInt(dmy[1]) == 'NaN' || '' + parseInt(dmy[2]) == 'NaN') || (dmy[0].length != 2 || dmy[0] < 1 || dmy[0] > 31) || (dmy[1].length != 2 || dmy[1] < 1 || dmy[1] > 12) || (dmy[2].length != 4 || dmy[2] < 1980 || dmy[2] > 2080)) {
                alert("Please enter a valid date.\n (e.g. 01-03-2006 in place of  March 1, 2006)");
                $('user_select3').focus();
                return false;
            }
            
        }
    
    if (($('phases4').value == 'Module Progress') || ($('phases4').value == 'Test Score') || ($('phases4').value == 'Time Spent(Module)') || ($('phases4').value == 'Time Spent(Test)')) {
        if (isNaN($('user_select4').value)) {
            alert('Please enter a numeric value');
            return false;
        }
    }
    else 
        if (($('phases4').value == 'Test Date') || ($('phases4').value == 'Activation Date')) {
            $('user_select4').value = $('user_select4').value.replace("/", "-");
            dmy = $('user_select4').value.split("-");
            
            if (('' + parseInt(dmy[0]) == 'NaN' || '' + parseInt(dmy[1]) == 'NaN' || '' + parseInt(dmy[2]) == 'NaN') || (dmy[0].length != 2 || dmy[0] < 1 || dmy[0] > 31) || (dmy[1].length != 2 || dmy[1] < 1 || dmy[1] > 12) || (dmy[2].length != 4 || dmy[2] < 1980 || dmy[2] > 2080)) {
                alert("Please enter a valid date.\n (e.g. 01-03-2006 in place of  March 1, 2006)");
                $('user_select4').focus();
                return false;
            }
            
        }
}

/////////////Advance report newyork end///////////////////////////////////////////////////////////////////////////////
function exit_final_assessment_test(host_name){
    $('exit_final').action = host_name + "/user/index"
    $('exit_final').submit();
}

function start_final_assessment_test(host_name){
    $('exit_final').action = host_name + "/user/search_for_registration_number_juliusbaer"
    $('exit_final').submit();
}

//for juliusbaer End/////
function orcle_report(host_name){
    $('report').action = host_name + "/user/orcle_report"
    $('report').submit();
}

function lp_report(host_name){
    $('report').action = host_name + "/user/orcle_report"
    $('report').submit();
}

function manager_report(host_name){
    $('report').action = host_name + "/user/manager_report"
    $('report').submit();
    
}

function uda_policy_report(host_name){
    $('report').action = host_name + "/user/uda_policy_training"
    $('report').submit();
}

function affirmation_report(rander_variable,fid){
	$('fid').value = fid
    $('report').action = rander_variable + "/user/compliance_affirmation_list"
    $('report').submit();
}

function mourant_secretary_report(rander_variable){
    $('report').action = rander_variable + "/admin/company_secretary_fundamentals_report"
    $('report').submit();
}

function all_secretary_fundamentals(host){
    if ($('all_records').checked == true) {
        document.forms[0].action = host + "/admin/company_secretary_fundamentals_report?" + "all=yes"
        
    }
    else {
        document.forms[0].action = host + "/admin/company_secretary_fundamentals_report?"
    }
    document.forms[0].submit();
}


function access_report(rander_variable){
    $('report').action = rander_variable + "/user/accesslog"
    $('report').method = "get";
    $('report').submit();
    
}

function lock_user(rander_variable){
    $('report').action = rander_variable + "/user/lock_user"
    $('report').submit();
    
}

/*  this function is add by vinay */
function change_class_juliusbaer_index(id){
    libox = 'libox' + id
    hrefbox = 'hrefbox' + id
    spanbox = 'spanbox' + id
    
    if (libox == 'libox1') {
        if ($('libox1').hasClassName('before_click_box')) {
        
            $('libox1').toggleClassName('after_click_box');
            $('hrefbox1').toggleClassName('after_click_box_link');
            $('spanbox1').toggleClassName('after_other_link');
            
        }
        if ($('libox2').hasClassName('after_click_box')) {
        
            $('libox2').toggleClassName('after_click_box');
            $('hrefbox2').toggleClassName('after_click_box_link');
            $('spanbox2').toggleClassName('after_other_link');
            
        }
        if ($('libox3').hasClassName('after_click_box')) {
        
            $('libox3').toggleClassName('after_click_box');
            $('hrefbox3').toggleClassName('after_click_box_link');
            $('spanbox3').toggleClassName('after_other_link');
            
        }
        if ($('libox4').hasClassName('after_click_box')) {
        
            $('libox4').toggleClassName('after_click_box');
            $('hrefbox4').toggleClassName('after_click_box_link');
            $('spanbox4').toggleClassName('after_other_link');
            
        }
    }
    if (libox == 'libox2') {
        if ($('libox2').hasClassName('before_click_box')) {
        
            $('libox2').toggleClassName('after_click_box');
            $('hrefbox2').toggleClassName('after_click_box_link');
            $('spanbox2').toggleClassName('after_other_link');
            
        }
        if ($('libox1').hasClassName('after_click_box')) {
        
            $('libox1').toggleClassName('after_click_box');
            $('hrefbox1').toggleClassName('after_click_box_link');
            $('spanbox1').toggleClassName('after_other_link');
            
        }
        if ($('libox3').hasClassName('after_click_box')) {
        
            $('libox3').toggleClassName('after_click_box');
            $('hrefbox3').toggleClassName('after_click_box_link');
            $('spanbox3').toggleClassName('after_other_link');
            
        }
        if ($('libox4').hasClassName('after_click_box')) {
        
            $('libox4').toggleClassName('after_click_box');
            $('hrefbox4').toggleClassName('after_click_box_link');
            $('spanbox4').toggleClassName('after_other_link');
            
        }
    }
    if (libox == 'libox3') {
        if ($('libox3').hasClassName('before_click_box')) {
        
            $('libox3').toggleClassName('after_click_box');
            $('hrefbox3').toggleClassName('after_click_box_link');
            $('spanbox3').toggleClassName('after_other_link');
            
        }
        if ($('libox1').hasClassName('after_click_box')) {
        
            $('libox1').toggleClassName('after_click_box');
            $('hrefbox1').toggleClassName('after_click_box_link');
            $('spanbox1').toggleClassName('after_other_link');
            
        }
        if ($('libox2').hasClassName('after_click_box')) {
        
            $('libox2').toggleClassName('after_click_box');
            $('hrefbox2').toggleClassName('after_click_box_link');
            $('spanbox2').toggleClassName('after_other_link');
            
        }
        if ($('libox4').hasClassName('after_click_box')) {
        
            $('libox4').toggleClassName('after_click_box');
            $('hrefbox4').toggleClassName('after_click_box_link');
            $('spanbox4').toggleClassName('after_other_link');
            
        }
    }
    if (libox == 'libox4') {
        if ($('libox4').hasClassName('before_click_box')) {
        
            $('libox4').toggleClassName('after_click_box');
            $('hrefbox4').toggleClassName('after_click_box_link');
            $('spanbox4').toggleClassName('after_other_link');
            
        }
        if ($('libox1').hasClassName('after_click_box')) {
        
            $('libox1').toggleClassName('after_click_box');
            $('hrefbox1').toggleClassName('after_click_box_link');
            $('spanbox1').toggleClassName('after_other_link');
            
        }
        if ($('libox2').hasClassName('after_click_box')) {
        
            $('libox2').toggleClassName('after_click_box');
            $('hrefbox2').toggleClassName('after_click_box_link');
            $('spanbox2').toggleClassName('after_other_link');
            
        }
        if ($('libox3').hasClassName('after_click_box')) {
        
            $('libox3').toggleClassName('after_click_box');
            $('hrefbox3').toggleClassName('after_click_box_link');
            $('spanbox3').toggleClassName('after_other_link');
            
        }
    }
}

/*  this function is add by vinay */
function change_class_calyon_london_index(id){
    libox = 'libox' + id
    hrefbox = 'hrefbox' + id
    
    if (libox == 'libox1') {
        if ($('libox1').hasClassName('before_click_box')) {
        
            $('libox1').toggleClassName('after_click_box');
            $('hrefbox1').toggleClassName('after_click_box_link');
            
            
        }
        if ($('libox2').hasClassName('after_click_box')) {
        
            $('libox2').toggleClassName('after_click_box');
            $('hrefbox2').toggleClassName('after_click_box_link');
            
            
        }
        
    }
    if (libox == 'libox2') {
        if ($('libox2').hasClassName('before_click_box')) {
        
            $('libox2').toggleClassName('after_click_box');
            $('hrefbox2').toggleClassName('after_click_box_link');
            
            
        }
        if ($('libox1').hasClassName('after_click_box')) {
        
            $('libox1').toggleClassName('after_click_box');
            $('hrefbox1').toggleClassName('after_click_box_link');
            
            
        }
        
    }
    
}




function approve_pending(rander_variable, req){
    $('report').action = rander_variable + "/user/pending_request_list?request=" + req
    $('report').submit();
    
}

function approve_pending_paris(host_name, request_status){
    $('report').action = host_name + "/user/approve_pending_paris?request=" + request_status
    $('report').submit();
}


function approve_pending_list_for_sgcnewyork(rander_variable, req){
    $('report').action = rander_variable + "/user/approve_pending_list_for_sgcnewyork?request=" + req
    $('report').submit();
    
}

function selected_pending_request(corporate,selected_request){
    location.href = corporate + "/user/approve_pending_list_for_sgcnewyork?" + "request=" + selected_request
}

function filter_learning_report_sgcnewyork(corporate){
    alert(corporate)
    var fil = $('name').value
    $('filter').action = corporate + "/user/approve_pending_list_for_sgcnewyork?" + "request=" + fil
    $('filter').submit();
}

function myteam_course(host){
    $('report').action = host + "/user/my_team_course"
    $('report').submit();
}

function classroom_training(rander_variable){
    $('report').action = rander_variable + "/user/classroom_training_report"
    $('report').submit();
}

function check_all(obj, classname){
    var s = $$('input.request_checkbox')
    for (var i = 0; i <= s.length - 1; i++) {
        if (s[i].disabled != true) {
            s[i].checked = obj.checked
        }
    }
}


function check_excel()
{
	if ($('user_list').value == '') {
		alert('Please browse excel file.')
		return false;
	}
}

function check_particular_course(obj,classname)
{
	div_id = "input"+"."+classname
	checked_elements = $('course_form').select('input:checked')
	if (checked_elements.size() == 1)
	{
	$$(div_id).first().checked = false
	}
	else
	{
	$$(div_id).first().checked = true
	}
}

function check_selected_course(obj,classname)
{
	div_id = "input"+"."+classname
	var input_checkboxes = $$(div_id);

	
	
	if(obj.checked)
	{
		input_checkboxes.first().checked = true;
		
	}
	else
	{
		checked_count=0
		for(var i=0;i<input_checkboxes.length;i++)
		{
			if(input_checkboxes[i].checked == true)
			{
				if (++checked_count>1)break;
			}
		}
		
		if(checked_count == 1 && input_checkboxes.first().checked == true)
		{
			input_checkboxes.first().checked = false;
		}
	}
		
	
}

function check_course(host){
	if ($("course_form").select("input[type='checkbox']") == "") {
		alert("Nothing assigned to this user.");
		return false;
	}
	else {
		checked_elements = $('course_form').select('input:checked')
		if (checked_elements.size() == 0) {
			alert("Please select atleast one checkbox")
			return false;
		}
		else {
			var status = confirm("Are you sure?")
			if (status != true) {
				return false;
			}
		}
	}
}


function check_all_admin(obj,classname)
{	
	var div_id = "input"+"."+classname
	var class_checkbox = $$(div_id)
	 for (var i = 0; i <= class_checkbox.length - 1; i++) {
            class_checkbox[i].checked = obj.checked
    }
}


function display_all_classroom_training_courses(){
    if ($('display').checked == true) {
        document.forms[0].action = "/user/classroom_training_report" + "?all=yes"
    }
    else {
        document.forms[0].action = "/user/classroom_training_report"
    }
    document.forms[0].submit();
}



function reject_user(pcm_id, user_id, page){
    var status = confirm('Are you sure, User has not attended this Classroom Training Course?')
    if (status == true && $('display').checked == true) {
        if (page == 0) {
            document.forms[0].action = "/user/reject_classroom_training?" + "user_id=" + user_id + "&pcm_id=" + pcm_id + "&all=yes"
        }
        else {
            document.forms[0].action = "/user/reject_classroom_training?" + "user_id=" + user_id + "&pcm_id=" + pcm_id + "&all=yes" + "&page=" + page
            
        }
        
        document.forms[0].submit();
    }
    else 
        if (status == true) {
            if (page == 0) {
            
                document.forms[0].action = "/user/reject_classroom_training?" + "user_id=" + user_id + "&pcm_id=" + pcm_id
            }
            else {
                document.forms[0].action = "/user/reject_classroom_training?" + "user_id=" + user_id + "&pcm_id=" + pcm_id + "&page=" + page
            }
            document.forms[0].submit();
        }
}

function reject_user_fundamentals(pcm_id, user_id, page){
    var status = confirm('Are you sure, User has not attended this Classroom Training Course?')
    
    if (status == true && $('all_records').checked == true) {
        if (page == 0) {
            document.forms[0].action = "/admin/reject_secretary_fundamentals?" + "user_id=" + user_id + "&pcm_id=" + pcm_id + "&all=yes"
        }
        else {
            document.forms[0].action = "/admin/reject_secretary_fundamentals?" + "user_id=" + user_id + "&pcm_id=" + pcm_id + "&all=yes" + "&page=" + page
        }
        document.forms[0].submit();
    }
    else 
        if (status == true) {
            if (page == 0) {
                document.forms[0].action = "/admin/reject_secretary_fundamentals?" + "user_id=" + user_id + "&pcm_id=" + pcm_id
            }
            else {
                document.forms[0].action = "/admin/reject_secretary_fundamentals?" + "user_id=" + user_id + "&pcm_id=" + pcm_id + "&page=" + page
                
            }
            document.forms[0].submit();
        }
}






function uncheck_box(chk_obj, cal_obj){
    return chk_obj.value = ""
    return cal_obj.value = ""
}




function not_viewed_secretary_fundamentals(host){
    document.forms[0].action = host + "/admin/company_secretary_fundamentals_report"
    document.forms[0].submit();
}

function front_uda_report(host_name){
    $('report').course.value = "uda"
    $('report').action = host_name + "/user/front_uda_policy_report"
    $('report').submit();
}

function front_daw_report(host_name){
    $('report').course.value = "daw"
    $('report').action = host_name + "/user/front_uda_policy_report"
    $('report').submit();
}

function front_mar_report(host_name){
    $('report').course.value = "mar"
    $('report').action = host_name + "/user/front_uda_policy_report"
    $('report').submit();
}

function front_fides_report(host_name){
    $('report').course.value = "fides"
    $('report').action = host_name + "/user/front_uda_policy_report"
    $('report').submit();
}

function front_bcp_report(host_name){
    $('report').course.value = "BCP"
	$('report').action = host_name + "/user/front_uda_policy_report"
    $('report').submit();
}

function all_uda_report(host_name){
    $('report').action = host_name + "/user/all_uda_report"
    $('report').submit();
}

function not_completed_uda_report(host_name, course_name){
    if (course_name == "daw"){
		$('not_daw').action = host_name + "/user/not_completed_uda_course"
        $('not_daw').submit();
    }
	else 
        if (course_name == "bcp") {
            $('bcp').action = host_name + "/user/not_completed_uda_course"
            $('bcp').submit();
        }
    else 
        if (course_name == "mar") {
            $('not_mar').action = host_name + "/user/not_completed_uda_course"
            $('not_mar').submit();
        }
        else 
            if (course_name == "uda") {
				$('not_uda').action = host_name + "/user/not_completed_uda_course"
                $('not_uda').submit();
            }
        else 
            if (course_name == "fides") {
				$('not_fides').action = host_name + "/user/not_completed_uda_course"
                $('not_fides').submit();
            }
            
}

function selected_not_completed_uda_course(user_type){
    $('three_module_report').action = "/user/selected_not_completed_uda_course"
    $('three_module_report').submit();
}

function not_completed_daw_report(host_name){
    $('not_daw').action = host_name + "/user/not_completed_uda_course?" + "course=daw"
    $('not_daw').submit();
}

function not_completed_mar_report(host_name){
    $('not_mar').action = host_name + "/user/not_completed_uda_course?" + "course=mar"
    $('not_mar').submit();
}


function addbookmark(){
    if (navigator.appName != 'Microsoft Internet Explorer') {
        window.sidebar.addPanel("Julius Baer Academy e-Learning Portal", "http://www.juliusbaer-academy.com", "");
    }
    else {
        window.external.AddFavorite("http://www.juliusbaer-academy.com", " Julius Baer Academy e-Learning Portal");
    }
}

function popup(){
    var d = window.open('preview_email_format', "CIFT", 'toolbar=no,menu=no,resizable=no,scrollbars=yes, status=no,width=600,height=550,top=100,left=100');
    d.focus();
}

function preview_remainder(host_url){
    var email_id = $('reminder_format_id').value
      url = "http://"+host_url+"/user/preview_remainder_format?email="+email_id
       var d = window.open(url, "CIFT", 'toolbar=no,menu=no,resizable=no,scrollbars=yes, status=no,width=600,height=550,top=100,left=100');
    d.focus();
}




function submit_preview(){
    var target = document.getElementById("preview");
    target.setAttribute("target", "popup");
    target.setAttribute("action", "/user/preview_email_format");
    OpenWin = this.open("preview", "popup", "toolbar=no,menu=no,resizable=no,scrollbars=yes, status=no,width=600,height=550,top=100,left=100");
    target.submit();
}

function add_update_preview(host_name){
	if ($("email_user_name").value == "") {
		alert("Please Provide Format Name");
		return false;
	}
	else 
		if ($("email_user_subject").value == "") {
			alert("Please Provide Subject");
			return false;
		}
		else 
			if ($("email_user_from").value == "" || $("email_user_from").value.match(/^(.+)@(.+)\.(.+)$/) == null) {
				alert("Please enter a valid email address.");
				return false;
			}
			else 
				if (mce_editor_0.document.body.innerHTML == "<br>" || mce_editor_0.document.body.innerHTML =="&nbsp;<br>"  || mce_editor_0.document.body.innerHTML =="&nbsp; <br>") {
					alert("Please Provide Body Content ")
					return false;
				}
				else {
					var target = document.getElementById("preview");
					target.removeAttribute("target");
					$('preview').action = host_name + '/user/template_format_save'
					$('preview').submit();
				}
}

function forgot_password(){
    var d = window.open('/login/forgot_password', "Forgot_Password", 'toolbar=no,menu=no,resizable=no,scrollbars=yes, status=no,width=600,height=300,top=225,left=200');
    d.focus();
}

function request_account(){
    document.forms[0].action = "/login/request_for_new_account"
    document.forms[0].submit();
}

function cancel_for_abnabro(){
    document.forms[0].action = "/login/index"
    document.forms[0].submit();
}


function check_password(host_name, id){
    if ($('change_password').value != $('change_password_confirmation').value || $('change_password').value == "" || $('change_password_confirmation').value == "") {
        alert('Please Confirm the Password');
    }
    else {
        document.forms[0].action = host_name + "/user/update_password?user_id=" + id + "&password=" + $('change_password').value
        document.forms[0].submit();
    }
}



function show_option(attribute){
    if (attribute == "--Please Select --") {
        $('option_criteria').show();
        $('option_criteria_created').hide();
        $('optin_criteria_new').hide();
    }
    else 
        if (attribute == "Created On") {
            $('option_criteria').hide();
            $('option_criteria_created').show();
            $('optin_criteria_new').hide();
        }
        else {
            $('option_criteria').hide();
            $('option_criteria_created').hide();
            $('optin_criteria_new').show();
        }
    
}

function show_option1(attribute){
    if (attribute == "--Please Select --") {
        $('option_criteria1').show();
        $('option_criteria_created1').hide();
        $('optin_criteria_new1').hide();
    }
    else 
        if (attribute == "Created On") {
            $('option_criteria1').hide();
            $('option_criteria_created1').show();
            $('optin_criteria_new1').hide();
        }
        else {
            $('option_criteria1').hide();
            $('option_criteria_created1').hide();
            $('optin_criteria_new1').show();
        }
    
}

function check_display(){
    if ($('add_option').value == '--') {
        $('and_or_option').hide();
    }
    else {
        $('and_or_option').show();
    }
}


/*function password_check_asia(host_name)
 //{
 //	if($('user_password').value =="" || $('user_password_confirmation').value =="")
 //	{
 alert("Please Enter New Password")
 }
 else if($('user_password').value != $('user_password_confirmation').value || $('user_password').value.length < 8 )
 {
 alert("The password must at least 8 characters long, using a mixture of upper and lower case characters and atleast one number.This password does not meet the minimum requirements")
 }
 else
 {
 document.forms[0].action = "/user/update_password"
 document.forms[0].submit()
 }
 }*/

// Function Added For Counting the charecters entered in text field or text area // Start
function countChars(limit, obj, id){
    var obj2 = $(id);
    var len = $(obj).value.length;
    /*var len = obj.value.length;*/
    
    obj2.value = limit - len;
    
    if (len >= limit) {
        obj2.value = limit - len;
        obj.value = obj.value.substring(0, limit - 1);
        //alert("Maximum character length exceeded("+l+"):"+len)
    }
    else {
        return;
        //obj2.value = obj.value.substring(0, obj.value.length - 1)
        //document.getElementById(txt).value=str.substr(0,str.length-1);
    }
}

// Function Added For Counting the charecters entered in text field or text area // End



function lp_report(host_name){
    $('report').action = host_name + "/user/lp_report"
    $('report').submit();
}

function spacific_course_report(host_name){
}

function lp_course_report(host_name){
    $('lp_report').action = host_name + "/user/course_report"
    $('lp_report').submit();
}

function lp_report_specific_user(host_name){
    $('lp_report').action = host_name + "/user/specific_user"
    $('lp_report').submit();
}
function login_attendance(host_name){
    $('lp_report').action = host_name + "/user/login_attendance"
    $('lp_report').submit();
}
function test_diagnostics(host_name){
    $('lp_report').action = host_name + "/user/test_diagnostics"
    $('lp_report').submit();
}

function most_recent_post(question_id, module_id){
    $('report').action = "/forum/reply?forum_question_id=" + question_id + "&mod_id=" + module_id + "&order=most_recent_post"
    $('report').submit();
}

function most_recent_post_list(question_id, topic){
    $('report').action = "/user/most_recent_post_list?forum_question_id=" + question_id + "&topic_id=" + topic
    $('report').submit();
}

function order_of_post(question_id, module_id){
    $('report').action = "/forum/reply?forum_question_id=" + question_id + "&mod_id=" + module_id
    $('report').submit();
}

function order_of_post_list(question_id, topic){
    $('report').action = "/user/reply_answer?forum_question_id=" + question_id + "&topic_id=" + topic
    $('report').submit();
}



function most_recent_post_index(host_name, question_id, lp_course_id,controller)
{
    change_order_of_post_index(host_name, question_id, lp_course_id,controller,"most_recent_post")
}

function order_of_post_index(host_name, question_id, lp_course_id,controller)
{
    change_order_of_post_index(host_name, question_id, lp_course_id,controller,null)
}


function change_order_of_post_index(host_name, question_id, lp_course_id,controller,order_by)
{
    if (controller==null)
    {
        controller="user"
    }
    $('report').action = host_name + "/"+controller+"/reply_question?forum_question_id=" + question_id + "&pc_id=" + lp_course_id + "&order="+order_by
    $('report').submit();
}




function chk(){
    if (document.myform.user_username.value == "") {
        alert("Please enter user id.");
        document.myform.user_username.focus();
        return false;
    }
    else 
        if (document.myform.user_password.value == "") {
            alert("Please enter password.");
            document.myform.user_password.focus();
            return false;
        }
}

function check_value_juliusbaer(){
    var obj1 = document.getElementById('lp_id');
    var obj2 = document.getElementById('conditions');
    if (obj1.value == "") {
        alert('Please select a Course');
        document.main_input.lp_id.focus();
        return false;
    }
    if (obj2.value == "") {
        alert('Please select a Course Status');
        document.main_input.conditions.focus();
        return false;
    }
    return true;
}

function update_course_name()
{
	e=document.getElementById('lp_id');
	course_name=e[e.selectedIndex].text;
	$('course_name').value = course_name
}

function check_value_caloy_asia(){
    var obj1 = document.getElementById('course_id');
    var obj2 = document.getElementById('course_status');
    if (obj1.value == "") {
        alert('Please select a Course');
        //document.main_input.course_id.focus();
        return false;
    }
    if (obj2.value == "") {
        alert('Please select a Course_Status');
        //document.main_input.course_status.focus();
        return false;
    }
    return true;
}

function update_dept_abnamro(host_name){
    $('dept').action = host_name + "/user/register_abnamro"
    $('dept').submit();
}


function prview_news(from, subject, description){
    var from = $('news_d')
    var d = window.open('preview_news_abnamro?desc=' + from, 'toolbar=no,menu=no,resizable=no,scrollbars=yes, status=no,width=600,height=550,top=100,left=100');
    
}

function password_check_sgcibtraining(host_name){
    //trim('password_newpass',document.f1.password_newpass.value);
    //trim('password_confpass',document.f1.password_confpass.value);
    if (document.f1.newpass.value == '') {
        alert("Please enter New Password.");
        return false;
    }
    
    else if (document.f1.newpass.value != document.f1.confpass.value) {
            alert("Please confirm the password.");
            return false;
        }
    else{
            document.f1.action = host_name + "/user/update_password";
            document.f1.submit();
        }
}

function password_check_wachovia(host_name){
    //trim('password_newpass',document.f1.password_newpass.value);
    //trim('password_confpass',document.f1.password_confpass.value);
    
    if (document.f1.password_newpass.value == '') {
        alert("Please enter New Password.");
        return false;
    }
    
    else 
        if (document.f1.password_newpass.value != document.f1.password_confpass.value) {
            alert("The password does not match.");
            return false;
        }
    document.f1.action = host_name + "/user/update_password?newpass=" + $('password_newpass').value
    document.f1.submit();
}

function password_check_juliusbaer(){
    //trim('password_newpass',document.f1.password_newpass.value);
    //trim('password_confpass',document.f1.password_confpass.value);
    
    if (document.f1.password_newpass.value == '') {
        alert("Please enter New Password.");
        return false;
    }
    else 
        if (document.f1.password_newpass.value.length < 8) {
            alert("Note: The password may be alpha-numeric, with a minimum of 8 characters/ digits.\nThis password does not meet this rule.");
            return false;
        }
        else 
            if (document.f1.password_newpass.value != document.f1.password_confpass.value) {
                alert("The two entries do not match! Please input and confirm your new password.");
                return false;
            }
    
}


function exit_full_window(){
    //    parent.opener.location.reload();
    parent.window.close();
}

//function exit_full_window()
//{
//    parent.window.close();
//    window.location.replace(window.location.protocol + "//" + window.location.host + "/calyonasia/user/refresh_show_module")
//}

function cancel_news_abnamro(host_name){
    $('news').action = host_name + "/user/news_list_abnamro"
    $('news').submit();
}

function reload_submit(host_name, module_id){
    var title = $('post_question_title').value
    var question = $('post_question').value
    
    if (title == "") {
        alert("Please fill the question title before submitting.");
        return false;
    }
    if (question == "") {
        alert("Please fill the question before submitting.");
        return false;
    }
    if (title != "" && question != "") {
        document.forms[0].action = host_name + "/forum/save_post?mod_id=" + module_id + "&msg_status=" + 0 + "&reply_status=" + 0 + "&archive_status=" + 0
        document.forms[0].submit();
        pause(2000);
        window.opener.location.reload();
        window.close();
    }
}

function forum_post_validate(){

}

function icon_clear(){
    document.forms[0].action = "/user/display_icons"
    document.forms[0].submit();
}

function pause(numberMillis){
    var now = new Date();
    var exitTime = now.getTime() + numberMillis;
    while (true) {
        now = new Date();
        if (now.getTime() > exitTime) 
            return;
    }
}


function position_change(posincrement){

    if (document.topic_form.topic_id.selectedIndex == -1 || document.topic_form.topic_id.selectedIndex + posincrement < 0 || document.topic_form.topic_id.selectedIndex + posincrement >= document.topic_form.topic_id.length) 
        return;
    
    var t1 = document.topic_form.topic_id.options[document.topic_form.topic_id.selectedIndex + posincrement].text;
    var t2 = document.topic_form.topic_id.options[document.topic_form.topic_id.selectedIndex].text;
    
    var v1 = document.topic_form.topic_id.options[document.topic_form.topic_id.selectedIndex + posincrement].value;
    var v2 = document.topic_form.topic_id.options[document.topic_form.topic_id.selectedIndex].value;
    
    document.topic_form.topic_id.options[document.topic_form.topic_id.selectedIndex + posincrement].text = t2;
    document.topic_form.topic_id.options[document.topic_form.topic_id.selectedIndex].text = t1;
    
    document.topic_form.topic_id.options[document.topic_form.topic_id.selectedIndex + posincrement].value = v2;
    document.topic_form.topic_id.options[document.topic_form.topic_id.selectedIndex].value = v1;
    
    document.topic_form.topic_id.selectedIndex = document.topic_form.topic_id.selectedIndex + posincrement;
    
}

function edit_topic(id){
    for (i = 0; i < document.topic_form.topic_id.length; i++) {
        //alert(document.f1.sequence_id.options[i].value);
        document.topic_form.topic_id.options[i].selected = true;
    }
    document.topic_form.action = "/user/update_forum_topic?topic_id=" + id
    document.topic_form.submit();
}

function edit_topic_cancel(){
    document.topic_form.action = "/user/add_topics"
    document.topic_form.submit();
}

function goto_index(host_name){
    document.forms[0].action = host_name + "/user/index"
    document.forms[0].submit();
}



function record_test(){
    if (confirm("You are about to exit the Module test. Your previous score will be replaced with the new scores. We would suggest that you complete the test.\n DO YOU STILL WISH TO EXIT?")) {
        $('sample').action = '/corporate_juliusbaer/module/recordtest_save?flag=' + 'exit';
        $('sample').submit();
    }
}

function exit_recorded_test(corporate){
    if (confirm("You are about to exit the Module test. Your previous score will be replaced with the new scores. We would suggest that you complete the test.\n DO YOU STILL WISH TO EXIT?")) {
        $('sample').action = corporate + "/module/recordtest_save?flag=" + "exit";
        $('sample').submit();
    }
}

function save_exit_recorded_test(){
    if (confirm("Your test progress will be saved. Click \"OK\" to save your progrss and exit the test or \"Cancel\" to return to the test.")) {
        $('sample').action = '/corporate_calyonasia/module/save_exit_recorded_test';
        $('sample').submit();
    }
}


function old_recorded_test(){
    if (eval(document.old_test_form.old_test)) {
        isChecked = false;
        for (i = 0; i < document.old_test_form.old_test.length; i++) {
            if (document.old_test_form.old_test[i].checked) {
                isChecked = true;
                break;
            }
        }
        if (!isChecked) {
            alert("Please select your Incompleted/ new Test option.");
            return;
        }
    }
    if (confirm("You are about to take the module test.  In case you have already taken this test and you still choose to proceed, your previous scores will be replaced with the new ones.\nClick Ok to proceed or else click Cancel.")) {
        $('old_test_form').submit();
    }
}

function print_preview(){
    var win_options = "toolbar=no,scrollbars=yes,height=710,resizable=yes ";
    window.open("/user/calyon_print_preview", "terms", win_options).focus();
}

function print_preview_question(){
    var win_options = "toolbar=no,scrollbars=yes,height=710,resizable=yes ";
    window.open("/user/calyon_print_preview_question", "terms", win_options).focus();
}

////////////////////checks the values for course specific report///////////////////////////////////////
function show_div_abnamro(first_div, second_div){
    if (first_div.style.display == "") {
        first_div.style.display = "none"
        second_div.style.display = ""
    }
    else {
        second_div.style.display = "none"
        first_div.style.display = ""
    }
}


function expandall(){
    for (i = 1; i <= 1000; i++) {
        var temp = "course_module1" + i
        var temp1 = "course_module" + i
        $(temp1).style.display = "none"
        $(temp).style.display = ""
    }
}


function collapseall(){
    for (i = 1; i <= 300; i++) {
        var temp = "course_module1" + i
        var temp1 = "course_module" + i
        $(temp1).style.display = ""
        $(temp).style.display = "none"
    }
}

/////////////////////////END///////////////////////////////////////////////////////////
function sort_by_name(){
    alert('hai');
}

///////////////////////////for calyon-london change password//////////////////////////////
function validate(val){
    var countUpper = 0;
    var countLower = 0;
    var countNum = 0;
    
    for (i = 0; i < val.length; i++) {
        if (isNaN(val.charAt(i))) {
            if (val.charAt(i) == (val.charAt(i)).toLowerCase()) 
                countLower++;
            if (val.charAt(i) == (val.charAt(i)).toUpperCase()) 
                countUpper++;
        }
        else 
            countNum++;
    }
    if (countLower > 0 && countUpper > 0 && countNum > 0) 
        return true;
    else 
        return false;
    
}

function password_check_calyon(host_name){

    trim('newpass', document.f1.newpass.value);
    trim('confpass', document.f1.confpass.value);
    
    if (document.f1.newpass.value == '') {
        alert("Please enter New Password.");
        return false;
    }
    else 
        if (document.f1.newpass.value.length < 8) {
            alert("The password must at least 8 characters long, using a mixture of upper and lower case characters and atleast one number.\nThis password does not meet the minimum requirements.");
            return false;
        }
        
        else 
            if (!validate(document.f1.newpass.value)) {
                alert("The password must at least 8 characters long, using a mixture of upper and lower case characters and atleast one number.\nThis password does not meet the minimum requirements.");
                return false;
            }
            else 
                if (document.f1.newpass.value != document.f1.confpass.value) {
                    alert("The two entries do not match! Please input and confirm your new password.");
                    return false;
                }
    		document.f1.action = host_name+"/user/update_password"
    		document.f1.submit();
    
}


function password_check(host_name){
    trim('newpass', document.f1.newpass.value);
    trim('confpass', document.f1.confpass.value);
    
    if (document.f1.newpass.value == '') {
        alert("Please enter New Password.");
        return false;
    }
    else 
        if (document.f1.newpass.value.length < 8) {
            alert("The password must at least 8 characters long, using a mixture of upper and lower case characters and atleast one number.\nThis password does not meet the minimum requirements.");
            return false;
        }
        
        else 
            if (!validate(document.f1.newpass.value)) {
                alert("The password must at least 8 characters long, using a mixture of upper and lower case characters and atleast one number.\nThis password does not meet the minimum requirements.");
                return false;
            }
            else 
                if (document.f1.newpass.value != document.f1.confpass.value) {
                    alert("The two entries do not match! Please input and confirm your new password.");
                    return false;
                }
    document.f1.action = host_name + "/user/update_password"
    document.f1.submit();
    
}



function password_check_mourant(host_name, from){
    trim('newpass', document.f1.newpass.value);
    trim('confpass', document.f1.confpass.value);
    
    if (document.f1.newpass.value == '') {
        alert("Please enter New Password.");
        return false;
    }
    else 
        if (document.f1.newpass.value.length < 8) {
            alert("The password must at least 8 characters long, using a mixture of upper and lower case characters and atleast one number.\nThis password does not meet the minimum requirements.");
            return false;
        }
        
        else 
            if (!validate(document.f1.newpass.value)) {
                alert("The password must at least 8 characters long, using a mixture of upper and lower case characters and atleast one number.\nThis password does not meet the minimum requirements.");
                return false;
            }
            else 
                if (document.f1.newpass.value != document.f1.confpass.value) {
                    alert("The two entries do not match! Please input and confirm your new password.");
                    return false;
                }
    if (from == "") {
        document.f1.action = host_name + "/user/update_password"
    }
    else {
        document.f1.action = host_name + "/login/update_password_mourant"
    }
    
    
    document.f1.submit();
    
}


function trim(fieldname, fieldvalue){
    var object = eval('document.f1.' + fieldname);
    object.value = fieldvalue.replace(/^\s+/, '').replace(/\s+$/, '');
}

//////////////////////////////////////////for calyon-london change password/////////////////////////////////
function check_fields(host_name){
    if ($('filter_third').value != "" && $('filter_first').value == "") {
        alert("Please select field first.");
        $('filter_third').value = ""
    }
    else 
        if ($('filter_seventh').value != "" && $('filter_fifth').value == "") {
            alert("Please select field first.");
            $('filter_seventh').value = ""
        }
        else 
            if ($('filter_text').value != "" && $('filter_eigth').value == "") {
                alert("Please select field first.");
                $('filter_text').value = ""
            }
            else 
                if ($('filter_last').value != "" && $('filter_twelth').value == "") {
                    alert("Please select field first.");
                    $('filter_last').value = ""
                }
                else 
                    if ($('filter_first').value == "" && $('filter_third').value == "" && $('filter_fifth').value == "" && $('filter_seventh').value == "" && $('filter_eigth').value == "" && $('filter_twelth').value == "" && $('filter_last').value == "" && $('filter_text').value == "") {
                        $('user_report').action = host_name + "/user/user_report_adviseracademy?all=true"
                        $('user_report').submit();
                    }
                    else {
                        $('user_report').action = host_name + "/user/user_report_adviseracademy"
                        $('user_report').submit();
                    }
    
}

trim

function lp_report_adviseracademy(host_name){
    $('report').action = host_name + "/user/learning_report_adviser"
    $('report').submit();
}

function check_required_field(host_name){
   
    if ($('user_request_account_firstname').value == "") {
        alert("Please type first name. This is a required field.");
        $('user_request_account_firstname').focus();
        return false;
    }
        if ($('user_request_account_lastname').value == "") {
            alert("Please type last name. This is a required field.");
            $('user_request_account_lastname').focus();
            return false;
        }
            if ($('user_request_account_email').value == "" || $('user_request_account_email').length <= 6 || $('user_request_account_email').value.indexOf('@', 0) == -1 || $('user_request_account_email').value.indexOf('.', 0) == -1) {
                alert("'' " + $('user_request_account_email').value + " '', is not valid Email Address.");
                $('user_request_account_email').value = "";
                $('user_request_account_email').focus();
                return false;
            }
                            if (($('user_request_account_firstname').value.charAt(0) >= 'a' && $('user_request_account_firstname').value.charAt(0) <= 'z') || ($('user_request_account_firstname').value.charAt(0) >= 'a' && $('user_request_account_firstname').value.charAt(0) <= 'z')) {
                            rfname = $('user_request_account_firstname').value.charAt(0).toUpperCase() + $('user_request_account_firstname').value.substring(1);
                            rlname = $('user_request_account_lastname').value.charAt(0).toUpperCase() + $('user_request_account_lastname').value.substring(1);
                           
                            if (status = confirm("Click OK to capitalise the first letter of the Name (" + rfname + " " + rlname + ") or Cancel to continue without capitalisation (" + $('user_request_account_firstname').value + " " + $('user_request_account_lastname').value + ")")) {
                                if ($('user_request_account_firstname').value.charAt(0) > 'Z')
                                    $('user_request_account_firstname').value = rfname;
                                if ($('user_request_account_lastname').value.charAt(0) > 'Z')
                                    $('user_request_account_lastname').value = rlname;
                            }
                            $('request_account').action = host_name + "/user/save_user_westlb"
                $('request_account').submit();
                        }
                                
               
 }

function roll_out(host_name){
    $('report').action = host_name + "/user/rollout_groups"
    $('report').submit();
}


function check_firstname_westlben(host_name, grp){
   var firstname = $('user_search_firstname').value
   if (firstname == "") {
           alert('Please Enter First Name');
           $('user_search_firstname').focus();
       //$('add_user_form').action = host_name + "/user/add_group_user_westlben?" + "group_id=" + grp
       //$('add_user_form').submit();
   }
   else {
       $('add_user_form').action = host_name + "/user/check_user_westlben?" + "firstname=" + firstname + "&group_id=" + grp
       $('add_user_form').submit();
   }
  }

function check_firstname_westlben_lp(host_name, lp){
   var firstname = $('user_search_firstname').value
   if (firstname == "") {
           alert('Please Enter First Name');
           $('user_search_firstname').focus();            // $('add_user_form').action = host_name + "/user/add_group_user_westlben?" + "lp_id=" + lp + "&from=" + "lp"
      // $('add_user_form').submit();
   }
   else {
       $('add_user_form').action = host_name + "/user/check_user_westlben?" + "firstname=" + firstname + "&lp_id=" + lp
       $('add_user_form').submit();
   }
  }

function check_lastname_westlben_lp(host_name, lp){
   var lastname = $('user_search_lastname').value
   if (lastname == "") {
   alert('Please Enter Last Name');
           $('user_search_lastname').focus();
       //$('add_user_form').action = host_name + "/user/add_group_user_westlben?" + "lp_id=" + lp + "&from=" + "lp"
       //$('add_user_form').submit();
   }
   else {
       $('add_user_form').action = host_name + "/user/check_user_westlben?" + "lastname=" + lastname + "&lp_id=" + lp
       $('add_user_form').submit();
   }
}

function check_lastname_westlben(host_name, grp){
   var lastname = $('user_search_lastname').value
   if (lastname == "") {
           alert('Please Enter Last Name');
           $('user_search_lastname').focus();
       //$('add_user_form').action = host_name + "/user/add_group_user_westlben?" + "group_id=" + grp
       //$('add_user_form').submit();
   }
   else {
       $('add_user_form').action = host_name + "/user/check_user_westlben?" + "lastname=" + lastname + "&group_id=" + grp
       $('add_user_form').submit();
   }
}

function check_email_westlben(host_name, grp){
   var email = $('user_search_email').value
   if (email == "") {
       alert('Please Enter Email');
           $('user_search_email').focus();
       //$('add_user_form').action = host_name + "/user/add_group_user_westlben?" + "group_id=" + grp
       //$('add_user_form').submit();
   }
   else {
       $('add_user_form').action = host_name + "/user/check_user_westlben?" + "email=" + email + "&group_id=" + grp
       $('add_user_form').submit();
   }
}

function check_email_westlben_lp(host_name, lp){
   var email = $('user_search_email').value
   if (email == "") {
    alert('Please Enter Email');
           $('user_search_email').focus();
      // $('add_user_form').action = host_name + "/user/add_group_user_westlben?" + "lp_id=" + lp + "&from=" + "lp"
      // $('add_user_form').submit();
   }
   else {
       $('add_user_form').action = host_name + "/user/check_user_westlben?" + "email=" + email + "&lp_id=" + lp
       $('add_user_form').submit();
   }
}

function reject_pending_request_for_sgcasia(formname, status){

    /*checkedone=false;		*/
    
    alert($('pending_request').value)
    
    window.open('/user/reject_pending_request', "Forgot Password", 'toolbar=no,menu=no,resizable=no,scrollbars=yes, status=no,width=600,height=300,top=225,left=200');
}

function get_matched_result(host_name, grp, firstname, lastname, email){
    var win_options = "toolbar=no,scrollbars=yes,height=710,resizable=yes ";
    if (firstname != 0) {
        window.open(host_name + "/user/check_partial_user_result?group_id=" + grp + "&firstname=" + firstname, "terms", win_options).focus();
    }
    else 
        if (lastname != 0) {
            window.open(host_name + "/user/check_partial_user_result?group_id=" + grp + "&lastname=" + lastname, "terms", win_options).focus();
        }
        else 
            if (email != 0) {
                window.open(host_name + "/user/get_matched_records?group_id=" + grp + "&email=" + email, "terms", win_options).focus();
            }
    
    
}


function get_matched_result_for_excel(host, grp, fname, lname, emp_email, emp_id, emp_bu, emp_cost_code, user_id){
    var options = "toolbar=no,scrollbars=yes,height=710,resizable=yes ";
    window.open(host + "/user/get_matched_records?group_id=" + grp + "&firstname=" + fname + "&lastname=" + lname + "&email=" + emp_email + "&employee_id=" + emp_id + "&cost_code=" + emp_cost_code + "&bu_no=" + emp_bu + "&id=" + user_id, "terms1", options).focus();
}

function get_matched_result_for_excel_and_lp(host, lp, fname, lname, emp_email, emp_id, emp_bu, emp_cost_code, user_id){
    var options = "toolbar=no,scrollbars=yes,height=710,resizable=yes ";
    window.open(host + "/user/get_matched_records?lp_id=" + lp + "&firstname=" + fname + "&lastname=" + lname + "&email=" + emp_email + "&employee_id=" + emp_id + "&cost_code=" + emp_cost_code + "&bu_no=" + emp_bu + "&id=" + user_id, "terms1", options).focus();
}

function get_checked_users_lp(host_name, lp){
    var arr = new Array();
    
    for (i = 0; i < document.sample1.userids.length; i++) {
        if (document.sample1.userids[i].checked == true) 
            arr.push(document.sample1.userids[i].value)
    }
    $('search_user').action = host_name + "/user/add_user_group?user_ids=" + arr + "&lp_id=" + lp
    $('search_user').submit();
    
}


function get_checked_users(host_name, grp){
    var arr = new Array();
    
    for (i = 0; i < document.sample.userids.length; i++) {
        if (document.sample.userids[i].checked == true) 
            arr.push(document.sample.userids[i].value)
    }
    $('search_user').action = host_name + "/user/add_user_group?user_ids=" + arr + "&group_id=" + grp
    $('search_user').submit();
    
}


function get_checked_users_and_lp(host_name, lp){
    var arr = new Array();
    
    for (i = 0; i < document.sample.userids.length; i++) {
        if (document.sample.userids[i].checked == true) 
            arr.push(document.sample.userids[i].value)
    }
    $('search_user').action = host_name + "/user/add_user_group?user_ids=" + arr + "&lp_id=" + lp
    $('search_user').submit();
    
}

function get_user_radio(host_name, grp, user_id){
    var arr = "";
   
    for (i = 0; i < document.user.group.length; i++) {
        if (document.user.group[i].checked == true)
            arr = document.user.group[i].value
    }
    $('user_search_form').action = host_name + "/user/update_temp_table?" + "&group_id=" + grp + "&user_id=" + user_id + "&latest_user_id=" + arr
    $('user_search_form').submit();
   // opener.location.reload();
   opener.location.href = host_name + "/user/user_westlb_from_partial_search?"+ "group_id=" + grp
    window.close();
   
}

function get_user_radio_lp(host_name, lp, user_id){
    var arr = "";
   
    for (i = 0; i < document.user.group.length; i++) {
        if (document.user.group[i].checked == true)
            arr = document.user.group[i].value
    }
    $('user_search_form').action = host_name + "/user/update_temp_table?" + "&lp_id=" + lp + "&user_id=" + user_id + "&latest_user_id=" + arr
    $('user_search_form').submit();
   opener.location.href = host_name + "/user/user_westlb_from_partial_search?"+ "lp_id=" + lp
    window.close();
   
}

//function get_user_radio(host_name,grp,n_comp_tr,l_tr)
//{
//	var arr = "";

//for (i=0; i<document.user.group.length; i++)
//{
//	if (document.user.group[i].checked==true)
//	 arr = document.user.group[i].parentNode
//	}
//  var b=  arr.parentNode.innerHTML
//    var last_tble = l_tr.gsub("present_","");
// opener.document.getElementById(l_tr).innerHTML = b
// Element.remove(opener.document.getElementById(n_comp_tr));
//   window.close();
//}


function disc(){
    var wOpen;
    var height1 = 350;
    var width1 = 330;
    var rn_w = Math.random();
    var rn_h = Math.random();
    var height = (screen.height - 390) * rn_h;
    var width = (screen.width - 30) * rn_w;
    
    if (height < 0) 
        height = 0;
    if (width < 0) 
        width = 0;
    
    if ((height + 350) >= screen.height) 
        height -= 430;
    if ((width + 350) >= screen.width) 
        width -= 330;
    
    path = "http://www.cift.com/jsp/website/disclaimer.jsp";
    
    var sOptions;
    
    wOpen = window.open(path, "DISC");
}

function priv(){
    var wOpen;
    var height1 = 350;
    var width1 = 330;
    var rn_w = Math.random();
    var rn_h = Math.random();
    var height = (screen.height - 390) * rn_h;
    var width = (screen.width - 30) * rn_w;
    
    if (height < 0) 
        height = 0;
    if (width < 0) 
        width = 0;
    
    if ((height + 350) >= screen.height) 
        height -= 430;
    if ((width + 350) >= screen.width) 
        width -= 330;
    
    
    
    path = "http://www.cift.com/jsp/website/privacy.jsp";
    
    var sOptions;
    
    
    wOpen = window.open(path, "PRIV");
}

function cont(){
    var wOpen;
    var height1 = 350;
    var width1 = 330;
    var rn_w = Math.random();
    var rn_h = Math.random();
    var height = (screen.height - 390) * rn_h;
    var width = (screen.width - 30) * rn_w;
    
    if (height < 0) 
        height = 0;
    if (width < 0) 
        width = 0;
    
    if ((height + 350) >= screen.height) 
        height -= 430;
    if ((width + 350) >= screen.width) 
        width -= 330;
    
    
    
    path = "http://www.cift.com/jsp/website/contact_us/index.jsp";
    
    var sOptions;
    
    
    wOpen = window.open(path, "PRIV");
}

function user_index(host_name){
    document.forms[0].action = host_name + "/user/index"
    document.forms[0].submit();
}

function post_validate(){
    if ($('reply_answer_answer').value == "") {
        alert('Please fill the answer before submitting.')
        $('reply_answer_answer').focus();
        return false;
    }
}

function cancel_post_forum(host_name, lpc_id, question_id, post_order){
    document.forms[0].action = host_name + "/user/reply_question?pc_id=" + lpc_id + "&forum_question_id=" + question_id + "&order=" + post_order
    document.forms[0].submit();
}

function add_question_validattion(){
    if ($('add_question_question_title').value == "") {
        alert("Please fill the question title before submitting.")
        $('add_question_question_title').focus();
        return false;
    }
    if ($('add_question_question').value == "") {
        alert("Please fill the question before submitting.")
        $('add_question_question').focus();
        return false;
    }
//    if ($('reply_answer') && $('reply_answer').value == "") {
//        alert("Please fill the answer before submitting.")
//        $('reply_answer').focus();
//        return false;
//    }
    
}

function add_answer_validattion(){
    if ($('reply_answer_answer').value == "") {
        alert("Please fill the answer before submitting.")
        $('reply_answer_answer').focus();
        return false;
    }
}

function add_validattion_reply(){
    if ($('reply_answer').value == "") {
        alert("Please fill the answer before submitting.")
        $('reply_answer').focus();
        return false;
    }
}


function new_request_validation_for_newyork(){
	var email_regex = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    if($("request_email").value == "" || !email_regex.test($("request_email").value)) {
        alert("\"" + $('request_email').value + "\", is not valid Email Address.");
        $('request_email').focus();
        return false;
    }
    
    if ($('request_firstname').value == "") {
        alert("Please Enter First Name");
        $('request_firstname').focus();
        return false;
    }
    
    if ($('request_lastname').value == "") {
        alert("Please Enter Last Name");
        $('request_lastname').focus();
        return false;
    }
    if ($('request_manager_name').value == "") {
        alert("Please Enter Manager Name");
        $('request_manager_name').focus();
        return false;
    }
    
    if ($('request_manager_email').value == "" || $('request_manager_email').value.length <= 6 || $('request_manager_email').value.indexOf('@', 0) == -1 || $('request_manager_email').value.indexOf('.', 0) == -1) {
        alert("'' " + $('request_manager_email').value + " '', is not valid Manager Email Address.");
        $('request_manager_email').focus();
        return false;
    }
    
    if (document.my_form.business.value == "") {
        alert("Please Select Department");
        //document.my_form.business.focus();
        return false;
    }
    if (document.my_form.cost.value == "") {
        alert("Please Select Department");
        //document.my_form.cost.focus();
        return false;
    }
    
}

function edit_profile_validation_for_newyork(){
    if ($('user_manager_email').value.match(/^(.+)@(.+)\.(.+)$/) == null) {
        alert("Invalid Manager E-mail:: " + $('user_manager_email').value)
        return false;
    }
    
    if ($('user_firstname').value == '') {
        alert("Please enter First Name.");
        document.forms[0].user_firstname.focus();
        return false;
    }
    else 
        if ($('user_lastname').value == '') {
            alert("Please enter Last Name.");
            document.forms[0].user_lastname.focus();
            return false;
        }
        else 
            if ($('user_email').value == '') {
                alert("Please enter Email.");
                return false;
            }
            else 
                if ($('user_manager').value == '') {
                    alert("Please select Manager.");
                    return false;
                }
                else 
                    if ($('user_employee_id').value == '') {
                        alert("Please input your Employee ID.");
                        return false;
                    }
                    else 
                        if ($('user_manager_email').value == '') {
                            alert("Please select Manager Email.");
                            return false;
                        }
                        else 
                            if ($('department_content').value == "No") {
                                alert("Please select department.");
                                return false;
                            }
    
    if ($('user_employee_id').value.length == '11') {
        return true;
    }
    else 
        if ($('user_employee_id').value.length != '11') {
            alert("The Employee ID number must be 11 characters long.\n If you do not know your employee ID you can find it in HCMS Self-Service in \"Your HCMS information\".");
            return false;
        }
}


function approve_pnding_request(corporate){
    checked_elements = $('TT').select('input:checked')
    
    if (checked_elements.size() == 0) {
        alert("No Record Selected!")
        return false;
    }
    
    var request_ids = new Array();
    
    checked_elements.each(function(element){
        request_ids.push(element.value)
    });
    window.open(corporate + "/user/approve_pending_request?request_id=" + request_ids, "approve_pending", 'toolbar=no,menu=no,resizable=no,scrollbars=yes, status=no,width=600,height=300,top=225,left=200');
}





function request_confirm(req_ids){
    var admin_remark = $('admin_remark').value
    $('approved_request').action = "/user/request_confirm?request_id=" + req_ids + "&remark=" + admin_remark
    $('approved_request').submit();
}

function reject_request_confirm(req_ids){
    var admin_remark = $('admin_remark').value
    $('approved_request').action = "/user/reject_request_confirm?request_id=" + req_ids + "&remark=" + admin_remark
    $('approved_request').submit();
    
}

function close_window_for_newyork(){
    /*$('submit').action = "/user/approve_pending_list_for_sgcnewyork?request=" + 'Pending'
    $('submit').submit();*/
    window.opener.location.reload();
    window.close();
}

function close_window_westlben(){
    parent.window.close();
	window.opener.location.reload();
}


function request_cancel(){
    window.close();
}

function reset_course(host_name, u_id){
    $('report').action = host_name + "/user/update_reset_course?user_id=" + u_id
    $('report').submit();
    window.opener.location.reload();
}

function reject_pending_request(corporate){
    checked_elements = $('TT').select('input:checked')
    
    if (checked_elements.size() == 0) {
        alert("No Record Selected!")
        return false;
    }
    
    var request_ids = new Array();
    
    checked_elements.each(function(element){
        request_ids.push(element.value)
    });
    window.open(corporate + "/user/reject_pending_request?request_id=" + request_ids, "reject_pending_request", 'toolbar=no,menu=no,resizable=no,scrollbars=yes, status=no,width=600,height=300,top=225,left=200');
}


function learning_report_for_sgc(host_name){
    $('report').action = host_name + "/user/reports"
    $('report').submit();
}

function module_feedback_submit(){
    alert("Your feedback has been submitted.");
    $('module_feedback').submit();
}

function section_feedback_submit(){
    alert("Your feedback has been submitted.");
    $('section_feedback').submit();
}

function lp_report_mourant(host, report_type){
    if (report_type == "oracle") {
        $('lp_report').action = host + "/user/oracle_report_mourant"
        $('lp_report').submit();
    }
    else 
        if (report_type == "specific_course") {
            $('lp_report').action = host + "/user/course_report_london"
            $('lp_report').submit();
        }
        else 
            if (report_type == "specific_user") {
                $('lp_report').action = host + "/user/specific_user"
                $('lp_report').submit();
            }
            else 
                if (report_type == "user_custom_report") {
                    $('lp_report').action = host + "/user/user_custom_report"
                    $('lp_report').submit();
                }
                else 
                    if (report_type == "advaced_report") {
                        $('lp_report').action = host + "/user/custom_report"
                        $('lp_report').submit();
                    }
}

function user_report_mourant(host){
    if ($('fields').value == "firstname" || $('fields').value == "lastname" || $('fields').value == "email") {
        var fields = $('fields').value
        var operators = $('operators').value
        var criteria_value = $('criteria_value').value
        $('custom_report').action = host + "/user/user_custom_report" + "?fields=" + fields + "&operators=" + operators + "&criteria_value=" + criteria_value
        $('custom_report').submit();
    }
    else {
        var fields = $('fields').value
        var operators = $('operators').value
        var defaultoptions = $('defaultoptions').value
        $('custom_report').action = host + "/user/user_custom_report" + "?fields=" + fields + "&operators=" + operators + "&defaultoptions=" + defaultoptions
        $('custom_report').submit();
    }
}

function email_schedule(reportNo, num){
    value = $("email_" + reportNo);
    if (num != null) 
        $("submit_reminder" + num).disabled = false;
    if ($("email_schedule_" + reportNo).value == "N" || $("email_schedule_" + reportNo).value == "D") {
        for (i = 0; i < value.options.length;) 
            value.options[0] = null;
    }
    else 
        if ($("email_schedule_" + reportNo).value == "W") {
            dayList = ["Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat"];
            for (i = 0; i < value.options.length;) 
                value.options[0] = null;
            for (i = 0; i < dayList.length; i++) 
                value[i] = new Option(dayList[i], i + 1);
        }
        else {
            for (i = 0; i < value.options.length;) 
                value.options[0] = null;
            for (i = 0; i < 31; i++) 
                value[i] = new Option(i + 1, i + 1);
        }
}

function subsidary_selection(){
    if ($("calyon_subsidary").value == "") {
        alert("Please select a Team");
        return false;
    }
    else 
        return true;
}


function lp_report_link(host_name, method){
    if (method != "uda_assigned_users") 
        $('lp_report').action = host_name + "/user/" + method
    else 
		$('course').value="uda"
        $('lp_report').action = host_name + "/user/" + method + "?course=uda"
        $('lp_report').submit();
}

function check_for_value(){
    if (document.filter_for_user.user_search_by.value == "") {
        alert("Please select the field.");
        document.filter_for_user.user_search_by.focus();
        return false;
    }
    else 
        if (document.filter_for_user.user_search_item.value == "") {
            alert("Please enter a value.");
            document.filter_for_user.user_search_item.focus();
            return false;
        }
    
}

function check_for_value_text_box(){
    if (document.filter_email_for_user.email_filter.value == "") {
        alert("Please enter email.");
        document.filter_email_for_user.email_filter.focus();
        return false;
    }
    
}

function check_for_value_assign(){
    if (document.assign_batch.batch_id.value == "") {
        alert("Please select a batch.");
        document.assign_batch.batch_id.focus();
        return false;
    }
    
    /*for (i = 0; i < document.assign_batch.user_userid.length; i++) {
        if (document.assign_batch.user_userid[i].checked) 
            return true;
    }*/
	
	checked_elements = $('assign_batch').select('input:checked')
    if (checked_elements.size() == 0) {
        alert("Please select a user.")
        return false;
    }
}

function check_for_user_select(){
    checked_elements = $('batch_user').select('input:checked')
    if (checked_elements.size() == 0) {
        alert("Please select a user.")
        return false;
    }
}

function display_icon(){
    if (document.icon.load_icon_icon_name.value == "") {
        alert('Select a image file.');
        return false;
    }
    else 
        if (document.icon.load_icon_icon_url.value == "") {
            alert('Please Select the Personal Icon');
            return false;
        }
}

function display_icon_mourant(){
    if (document.icon.load_icon_icon_name.value == "") {
        alert('Select a image file.')
        return false
    }
    else 
        if (document.icon.load_icon_icon_url.value == "") {
            alert('Please Select the Personal Icon')
            return false
        }
}

function checkValue(){
   if (document.for_password_check.user_email.value != "") {
       var value1 = document.for_password_check.user_email.value;
       var matchArray = value1.match(/^(.+)@(.+)\.(.+)$/)
       if (matchArray == null) {
           alert("Invalid email ID:: " + value1);
           document.for_password_check.user_email.value = "";
           document.for_password_check.user_email.focus();
           submitcount =0;
           return false;
                  }
   }
   else {
       alert("Please enter email ID");
       document.for_password_check.user_email.focus();
       submitcount =0;
       return false;
   }
}

var submitcount=0;
 function isSubmitted(){
      if (submitcount == 0){
             submitcount++;
             return checkValue();
       }else{
             alert("Your request is being submitted, Please wait!. Thanks!");
             return false;
       }
 }

function vld(frmno){
    switch (frmno) {
        case 1:
            if ($("batch_id").selectedIndex == 0) {
                alert("Please select a batch.");
                return false;
            }
            break;
        case 2:
            if ($("lp_id").selectedIndex == 0) {
                alert("Please select a course.");
                return false;
            }
            break;
        case 3:
            if ($("test_regno").value == "") {
                alert("Please enter Test Registration Number.");
                return false;
            }
            break;
        case 4:
            if ($("test_email").value == "") {
                alert("Please enter email.");
                return false;
            }
            break;
    }
}

function mourant_learning_report(host_name){
    $('report').action = host_name + "/user/mourant_general_full_report"
    $('report').submit();
    
}

function user_view_report_juliusbaer_start(host_name){
    $('myform').module_status.value = "S"
    $('myform').action = host_name + "/user/user_view_juliusbaer"
    $('myform').submit();
    
}

function user_view_report_juliusbaer_nc(host_name){
    $('myform').module_status.value = "CP"
    $('myform').action = host_name + "/user/user_view_juliusbaer"
    $('myform').submit();
    
}

function user_view_report_juliusbaer_snc(host_name){
    $('myform').module_status.value = "SNC"
    $('myform').action = host_name + "/user/user_view_juliusbaer"
    $('myform').submit();
    
}

function email_confirm(){
    return false;
}

function visibleBox(id, visiblehide){
    elm1 = document.getElementById("open" + id);
    if (!visiblehide) {
    
        if (elm1.style.display == "none") {
            visiblehide = ""
        }
        else {
            visiblehide = "none"
        }
    }
    
    showHideOpenClose(id, visiblehide);
    boxes = eval("box" + id);
    
    if (boxes.length) {
    
        for (i = 0; i < boxes.length; i++) {
            showHideBox(boxes[i], visiblehide);
        }
    }
    else {
        showHideBox(boxes, visiblehide);
        
    }
}

function forum_add_question(){
    if ($('add_question_question_title').innerhtml == "") {
        alert("Please fill the question title before submitting.");
        $('add_question_question_title').focus();
        return false;
    }
    else 
        if ($('add_question_question').innerhtml == "") {
            alert("Please fill the question before submitting.");
            $('add_question_question').focus();
            return false;
        }
}


function calyon_log_field_check(){
    if (document.my_form.user_log.value == "---please select---") {
        alert("Please select a field.");
        document.my_form.user_log.focus();
        return false;
    }
    
    
}

function corporate_report(host, controller, actionName)
{
    window.location = host + "/" + controller + "/" + actionName;
}

function sumbit_test_log(host_name){
    $('my_form').action = host_name + "/user/testlog"
    $('my_form').submit();
}

function sumbit_access_log(host_name){
    $('my_form').action = host_name + "/user/accesslog"
    $('my_form').submit();
}

function set_notification(hostname, eve, u_id){
    pause(2000);
    window.close();
    window.opener.location.reload();
}

function task_manager_fo_calyon_london(host_name){
    $('report').action = host_name + "/admin/task_manager_for_calyon_london"
    $('report').submit();
}

function task_validation(){
    if ($('request_completion_date').value == "") {
        alert('Please select Requested Completion Date')
        return false;
    }
    
    if ($('task_status').value == "") {
        alert('Please fill Status')
        return false;
    }
    
    if ($('task_task_description').value == "") {
        alert('Please fill Task Description')
        return false;
    }
    
}

function cancel_task(host_name){
    document.forms[0].action = host_name + "/admin/task_manager_for_calyon_london"
    document.forms[0].submit();
}

function question_answer_test_diagonstics(host_name, question_id){
	$('my_form').question_id.value=question_id
    $('my_form').action = host_name + "/user/question_and_corrext_answer_display"
    $('my_form').submit();
}

function checkerror(host_name){
	var email_regex = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
	if ($('email_id_new_account_email_id').value.length <= 6 || $('email_id_new_account_email_id').value.indexOf('@', 0) == -1 || $('email_id_new_account_email_id').value.indexOf('.', 0) == -1 || $('email_id_new_account_email_id').value == '' || !email_regex.test($("email_id_new_account_email_id").value))  {
    
        alert("'' " + $('email_id_new_account_email_id').value + " '', is not valid Email ID.");
        $('email_id_new_account_email_id').value = ""
        $('email_id_new_account_email_id').focus();
	 return false;
    }
    else {
        $('new_account').action = host_name + "/login/create_account_calyon?" + "corp=calyon_account"
        $('new_account').submit();
    }
}

function westlb_checkerror(host_name){
	/*var email_regex = /^([a-zA-Z0-9_\.\-])+\@(((westlb)+\.)+((co)+\.)+(uk))|(de)+$/;*/
	/*var email_regex = /^([a-zA-Z0-9_\.\-])+\@((westlb)+\.)+(([a-zA-Z]))+$/;*/
	var email_regex = /^([a-zA-Z0-9_\.\-])+\@((westlb)+\.)+((([a-zA-Z]))|\.+([a-zA-Z]))+$/;
	if ($('email_id_new_account_email_id').value.length <= 6 || $('email_id_new_account_email_id').value.indexOf('@', 0) == -1 || $('email_id_new_account_email_id').value.indexOf('.', 0) == -1 || $('email_id_new_account_email_id').value == '' || !email_regex.test($("email_id_new_account_email_id").value))  {
    
        alert("'' " + $('email_id_new_account_email_id').value + " '', is not valid Email ID.");
        $('email_id_new_account_email_id').value = ""
        $('email_id_new_account_email_id').focus();
	 return false;
    }
    else {
        $('new_account').action = host_name + "/login/create_account_calyon?" + "corp=calyon_account"
        $('new_account').submit();
    }
}


function check_field_login_page(host_name){
    if ($('user_request_account_firstname').value == "") {
		alert("please enter First Name");
		$('user_request_account_firstname').focus();
		return false;
	}
	else 
		if ($('user_request_account_lastname').value == "") {
			alert("please enter Last Name");
			$('user_request_account_lastname').focus();
			return false;
		}
		else 
			if ($('user_request_account_ut_number').value == "") {
				alert("please enter UT Number");
				$('user_request_account_ut_number').focus();
				return false;
			}
			else 
				if ($('user_request_account_employee_number').value == "") {
					alert("please enter Employee Number");
					$('user_request_account_employee_number').focus();
					return false;
				}
				else 
					if ($('user_request_account_cost_center').value == "") {
						alert("please enter Cost Centre");
						$('user_request_account_cost_center').focus();
						return false;
					}
					else 
						if (($('user_request_account_firstname').value.charAt(0) >= 'a' && $('user_request_account_firstname').value.charAt(0) <= 'z') || ($('user_request_account_firstname').value.charAt(0) >= 'a' && $('user_request_account_firstname').value.charAt(0) <= 'z')) {
							rfname = $('user_request_account_firstname').value.charAt(0).toUpperCase() + $('user_request_account_firstname').value.substring(1);
							rlname = $('user_request_account_lastname').value.charAt(0).toUpperCase() + $('user_request_account_lastname').value.substring(1);
							
							if (status = confirm("Click OK to capitalise the first letter of the Name (" + rfname + " " + rlname + ") or Cancel to continue without capitalisation (" + $('user_request_account_firstname').value + " " + $('user_request_account_lastname').value + ")")) {
								if ($('user_request_account_firstname').value.charAt(0) > 'Z') 
									$('user_request_account_firstname').value = rfname;
								if ($('user_request_account_lastname').value.charAt(0) > 'Z') 
									$('user_request_account_lastname').value = rlname;
							}
							
						}
					else
					  {
					  
					  }
}


function cancel_account(host_name){
    $('create_form').action = host_name + "/login/index"
    $('create_form').submit();
}

function sumbit_preview_email_format(host_name){
    $('my_form').action = host_name + "/user/email_format_preview"
    $('my_form').submit();
}

function sumbit_preview_email_next(host_name){
    $('my_form').action = host_name + "/user/email_format_preview?flag=next"
    $('my_form').submit();
}

function sumbit_preview_email_back(host_name){
    $('my_form').action = host_name + "/user/email_format_preview?flag=back"
    $('my_form').submit();
}


function validate_edit_profile(){

    //trim('firstname',document.f1.user_firstname.value);
    //trim('lastname',document.f1.user_lastname.value);
    //trim('email',document.f1.user_email.value);
    
    if (document.f1.user_firstname.value == "") {
        alert("Please enter First Name.");
        document.f1.user_firstname.focus();
        return false;
    }
    else 
        if (document.f1.user_lastname.value == "") {
            alert("Please enter Last Name.");
            document.f1.user_lastname.focus();
            return false;
        }
        else 
            if (document.f1.user_email.value == "") {
                document.f1.user_email.focus();
                alert("Please enter email.");
                return false;
            }
    
    
    if (document.f1.email.value != "") {
        var value1 = document.f1.email.value;
        var matchArray = value1.match(/^(.+)@(.+)\.(.+)$/)
        if (matchArray == null) {
            alert("Invalid E-mail:: " + value1);
            document.f1.email.focus();
            return false;
        }
    }
    
}


function for_not_completed_course(host_name){
    if ($('cost_code_filter').value == 'nopage') {
        $('three_module_report').cost_code.value = ''
    }
    else {
        $('three_module_report').cost_code.value = $('cost_code_filter').value
    }
    	$('three_module_report').action = host_name + "/user/not_completed_uda_course"
    	$('three_module_report').submit();
}

function for_completed_course(host_name){
    if ($('cost_code_filter').value == 'nopage') {
        $('three_module_report').cost_code.value = ''
    }
    else {
        $('three_module_report').cost_code.value = $('cost_code_filter').value
    }
    $('three_module_report').action = host_name + "/user/completed_uda_policy_training"
    $('three_module_report').submit();
}


function get_calyon_subsidary(host_name){
	type = ($('user_type').value)
    $('for_affirmation').action = host_name + "/user/get_calyon_subsidary?user_type=" + type
    $('for_affirmation').submit();
}



function submit_and_close(host){
    if ($('save_note').task_note.value == '') {
        alert('Please Enter Notes')
        return false
    }
    $('save_note').action = host + '/admin/save_note'
    $('save_note').submit();
    window.close();
    window.opener.location.reload();
    
}

function for_course_report_westlb(host_name){
    $('report_course').action = host_name + "/user/specific_course_report_westlb"
    $('report_course').submit();
}

function submit_lp_report(host_name, filter, order){

    $('lp_form').sort_by1.value = filter
    $('lp_form').order1.value = order
    $('lp_form').action = host_name + "/user/report_generate_for_sgcnewyork"
    $('lp_form').submit();
    
}

function check_reply_answer(host_name, str){
    if (str == 'from_reply_answer') {
        $('discussion_forum_reply').action = host_name + "/user/save_answer_for_discussion_forum"
        $('discussion_forum_reply').submit();
    }
    else 
        if (str == 'from_reply_for_answer') {
            $('discussion_forum_reply').action = host_name + "/user/save_for_answer"
            $('discussion_forum_reply').submit();
            
        }
}

function goto_index(host){
    url = host + "/login/index"
    window.location = url
}


function form_validation(host){
    if ($('user_request_account_firstname').value == '') {
        alert('Please enter the First Name');
        $('user_request_account_firstname').focus();
		return false;
    }
    else 
        if ($('user_request_account_lastname').value == '') {
            alert('Please enter the Last Name');
            $('user_request_account_lastname').focus();
			return false;
        }
        else {
			var fname = $('user_request_account_firstname').value.capitalize();
			var lname = $('user_request_account_lastname').value.capitalize();
			var output = "Click OK to capitalise the first letter of the Name ( "+$('user_request_account_firstname').value.capitalize()+" "+ $('user_request_account_lastname').value.capitalize() + ") or Cancel to continue without capitalisation ("+ $('user_request_account_firstname').value+" "+ $('user_request_account_lastname').value +")";			
			var status = confirm(output);
			if(status == true)
			{
				$('user_request_account_firstname').value = $('user_request_account_firstname').value.capitalize()
				$('user_request_account_lastname').value = $('user_request_account_lastname').value.capitalize()
				pause(200);
			    $('create_account').action = host + "/login/save_account_calyon"
    	        $('create_account').submit();
			}
			else
			{
				pause(200);
			    $('create_account').action = host + "/login/save_account_calyon"
    	        $('create_account').submit();
			}
			
        }
	
}


function selected_module(host_name, c_id, lpc, content_from){
    $('form').action = host_name + "/user/display_post?course_id=" + c_id + "&pc_id=" + lpc + "&from=" + content_from
    $('form').submit();
}

function show_all_post(host_name, c_id, lpc){
    $('form').action = host_name + "/user/display_post?course_id=" + c_id + "&pc_id=" + lpc
    $('form').submit();
}

function update_module(host_name, lpc){
    document.forms[0].action = host_name + "/user/add_question?pc_id=" + lpc
    document.forms[0].submit();
}

function quote(){

    if ($('hide_window')) {
        alert('Antony')
        $('hide_window').style.display = "none";
    }
}

function closeReply(){
    var rbox = document.getElementById('hide_window')
    Effect.toggle('hide_window', 'appear', 1)
    
}

//////////////////////////////////

function set_reminder(host_name, grp_id, record){
    $('set_reminder_form').action = host_name + "/user/save_remainder_westlben?" + "&group_id=" + grp_id + "&record=" + record
    $('set_reminder_form').submit();
   opener.location.reload();
    window.close();
    
    
}

function check_login(host){
    if ($('user_username').value == '') {
        alert('Please enter user id.');
        $('user_username').focus();
        return false
    }
    else 
        if ($('user_password').value == '') {
            alert('Please enter password.');
            $('user_password').focus();
            return false
            
        }
        else {
            $('login_form').action = host + "/login/login"
            $('login_form').submit();
        }
}

function check_exit(host_name){
    var status = confirm("You are about to exit the Assessment Test. You will not be able to return to this test at a later stage. We would suggest that you complete the test.DO YOU STILL WISH TO EXIT?")
    if (status == true) {
        document.forms[0].action = host_name + "/admin/atest_end?ststus=S"
        document.forms[0].submit();
    }
}


function report_for_module_requests(host_name,from){
	$('report').action = host_name + "/user/report_for_module_requests?from=" + from
    $('report').submit();
}

function usage_report(host_name,action,from){
    $('report').action = host_name + "/user/" + action + "?report_from=" + from
/*    $('report').action = host_name + "/user/usage_report"*/
    $('report').submit();
}

function hidePreviousDiv(){
    if ($("fq_1").style.display != "none") {
    
        Element.hide("fq_1")
    }
    for (i = 0; i < 10; i++) {
        if ($("fa_" + i) != null && $("fa_" + i).style.dispaly != "none") 
            Element.hide("fa_" + i);
    }
}


function checkModule(pcm_id, mins, chked, min, host_name){
    var min_time = min;
    var total_mins = parseInt(document.request_form.total_mins.value)
    if (chked) {
        total_mins += parseInt(mins);
    }
    else {
        total_mins -= parseInt(mins);
    }
    
    document.request_form.total_mins.value = total_mins;
    visibleBox(min_time, total_mins, host_name);
    alert("You are required to do " + min_time + " minutes of training,\n you have chosen " + total_mins + " minutes and therefore have " + ((total_mins < min_time) ? min_time - total_mins : 0) + " minutes left.")
}

function visibleBox(min_time, total_mins, host_name){
    var min_str = "";
    min_str = "<td width='670'><B>Minimum Time:</B> " + min_time + " minutes <B>Total Chosen:</B> " + total_mins + " minutes Balance:</B> " + ((total_mins < min_time) ? min_time - total_mins : 0) + " minutes</td>";
    
    elm0 = $('total_mins_td0');
    elm1 = $('total_mins_td1');
    
    //elm0.innerHTML=total_mins+" minutes&nbsp;";
    //elm1.innerHTML=total_mins+" minutes&nbsp;";
    
    elm0.innerHTML = min_str;
    elm1.innerHTML = min_str;
    
}

function check_value_for_module_request(host_name){
    var total = $('total_mins').value
    var min = $('min_time').value
    if (parseInt(total) < parseInt(min)) {
        alert("Your currect selection(" + total + " minutes) does not meet minimum requirement(" + min + " minutes). \n\nPlease select more modules.");
        return false;
    }
    var request_ids = new Array();
    
    for (i = 0; i < document.request_form.module_request.length; i++) {
        if (document.request_form.module_request[i].checked == true) {
        
            request_ids.push(document.request_form.module_request[i].value)
        }
        
    }
    $('request_form').action = host_name + "/user/confirm_request?request_id=" + request_ids
    $('request_form').submit();
}

function check_classroom_training(myform, target,i){
	
	
    check_classroom_training_object(myform.pcm_id, $('from_selector_'+i+''), myform.ischecked, target, 1, myform.action,i)
}

function check_classroom_training_object(pcm_id_obj, inputobj, chkobj, target, action, action_url,i){
	if (inputobj.value == "") {
        alert("Please select attend date.");
        chkobj.checked = false
        return false;
    }
    if (target == 1) {
        chkobj.checked = true
    }
    else 
        if (target == 2 && !chkobj.checked) {
            inputobj.value = ""
        }
    
    if (action == 1) {
        url = action_url + "?"
        url += "pcm_id=" + pcm_id_obj.value + "&"
		url += "from_selector=" + inputobj.value + "&"
        if (chkobj.checked) {
            url += "ischecked=" + chkobj.value + "&"
        }
        url += Math.random()
        new Ajax.Updater('class_room_update', url)
    }
    
    //myform.submit();
}


function uncheck_check_box(input_obj, chck_obj){
    if (input_obj.value == "") {
        alert("Please select attend date.")
        chck_obj.checked = false
        return false
    }
    else {
        input_obj.value = ""
    }
}


function atest_start(host){
    var status = confirm('This will archive your current courseware, retaining only the learning history, and re-start your Training Needs Analysis session. Please click "OK" to continue or "Cancel" to abort')
    if (status == true) {
        $('test_start').action = host + "/admin/relaunch_tna"
        $('test_start').submit();
    }
}

function goto_request_module(host_name){
    $('request_form').action = host_name + "/user/request_optional_module"
    $('request_form').submit();
}

function send_request_for_module(host_name){
    var status = confirm("Are you sure you want to submit?")
    if (status == true) {
        $('request_form').action = host_name + "/user/send_request_for_module"
        $('request_form').submit();
    }
}

function save_module_request(host_name){
    $('request_form').action = host_name + "/user/save_module_request"
    $('request_form').submit();
}


function exit_from_atest(host_name){
    //var status = confirm("You are about to exit the Assessment Test. You will not be able to return to this test at a later stage. We would suggest that you complete the test.DO YOU STILL WISH TO EXIT?")
    $('exit_from_atest').action = host_name + "/login/logout"
    $('exit_from_atest').submit();
    
}

function checkFormatTemplateForm(){
    //	alert(mce_editor_0.document.body.innerHTML); return false;
	if ($("email_user_name").value == "") {
        alert("Please Provide Format Name");
        return false;
    }
    else 
        if ($("email_user_subject").value == "") {
            alert("Please Provide Subject");
            return false;
        }
        else 
            if ($("email_user_from").value == "" || $("email_user_from").value.match(/^(.+)@(.+)\.(.+)$/) == null) {
                alert("Please enter a valid email address.");
                return false;
            }
            else 
			
				if (mce_editor_0.document.body.innerHTML == "<br>" || mce_editor_0.document.body.innerHTML == "&nbsp;<br>" || mce_editor_0.document.body.innerHTML == "&nbsp;&nbsp;<br>"  ) {
                    alert("Please Provide Body Content ");
                    return false;
                }
                else{
					return true;
				}   
}

function advanced_report_wachovia_2007(host_name,action,from){
    $('report').action = host_name + "/user/" + action + "?report_from=" + from 
    $('report').submit();
}





function update_user_icon(){
    var selected_value = $('use_icon').value
    
    if ($('use_icon').value == -1 || $('use_icon').value == '') {
        window.open("/forum/display_icons?icon_id=" + 8147, "icon_window", 'toolbar=no,menu=no,resizable=no,scrollbars=yes, status=no,width=400,height=400');
    }
    else
    {
        new Ajax.Updater('update_image', '/forum/update_user_icon', {
            asynchronous: true,
            evalScripts: true,
            parameters: 'icon=' + selected_value
        });
    }
}

function check_action(host_name){
    var selected_value = $('use_icon').value
    
    if ($('use_icon').value == -1 || $('use_icon').value == '') {
        window.open(host_name + "/forum/display_icons?icon_id=" + 8147, "icon_window", 'toolbar=no,menu=no,resizable=no,scrollbars=yes, status=no,width=400,height=400');
    }
    else {
        new Ajax.Updater('update_image', '/mourant/user/calyonasia_update_icon', {
            asynchronous: true,
            evalScripts: true,
            parameters: 'icon=' + selected_value
        });
    }
}


function for_course_report_mourant(host_name){
    $('report_form').action = host_name + "/user/specific_course_report_mourant"
    $('report_form').submit();
}

function sort_order_course(host_name, from_link, input){
    if (from_link == 'asc') {
        $('from_link').value = 'asc'
        $('report_form').action = host_name + "/user/specific_course_report_mourant"
    }
    else {
        $('from_link').value = 'dsc'
        $('report_form').action = host_name + "/user/specific_course_report_mourant"
    }
    $('filter_first').value = input
    $('report_form').submit();
}


function check_advanced_report(host){
    var status = confirm("Are you sure to send this report?")
    if (status == true) {
        document.forms[0].action = host + "/user/send_email_report?" + "&from=display_link"
        document.forms[0].submit();
        
    }
}

function check_fields_admin(host,action_name,id)
{
	var regex = "(^$)|(^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$)"
	if(action_name == 'update_corporate' || action_name == "create_corporate")
	{
		if($('corporate_name').value =="")
		{
			alert("Please Enter Corporate Name")
			$('corporate_name').focus();
			return false
		}
		else if($('corporate_site_url').value =="")
		{
			alert("Please Enter Site Url")
			$('corporate_site_url').focus();
			return false
		}
		else if(!$('corporate_site_url').value.match(regex))
		{
			alert("Please Enter Valid Site Url")
			$('corporate_site_url').value =""
			$('corporate_site_url').focus();
			return false
		}
		
		else if($('corporate_name').value !="" && $('corporate_site_url').value !="")
		{
			$('corporate_form').action = host+"/setup/"+action_name+"?"+"id="+id
	
		}

	}
		else if(action_name == 'bunch_create' || action_name =='bunch_update')
		{
			if($('bunch_bunch_name').value =="")
			{
				alert("Please Enter Bunch Name")
				return false
			}
			else
			{
			$('bunch_form').action = host+"/setup/"+action_name

			}
			
		}
}


function delete_corporate(host)
{
	var status = confirm("Are You Sure You want to remove corporate?")
	if(status != true)
	{
		$('corporate_form').action=host+"/setup/delete_corporate"
	}
	else
	{
		return false;
	}
}


	function check_fields_lp(host,action)
	
	{
		if ($('learning_program_lp_name').value == "")
		{
			alert("Please Enter Learning Program Name");
			$('learning_program_lp_name').focus();
			return false;
		}
		else if($('start_date').value == "")
		{
			alert("Please Enter Start Date");
			$('start_date').focus();
			return false;
		}
		else if($('expiry_date').value == "")
		{
			alert("Please Enter Expiry Date");
			$('expiry_date').focus();
			return false;
		}
		else if($('sequence_id').value == "" || isNaN($('sequence_id').value))
		{
			alert("Please Enter Valid Sequnce Id");
			$('sequence_id').focus();
			return false;
		}
		else
		{
			return true;
		}
	}

	function delete_lp_under_bunch(host,from)
	{
			var status = confirm("Are You Sure?")
			if(status == true && from !="bunch")
	{
		$('bunch_form').action=host+"/setup/delete_lp"
		$('bunch_form').submit();
	}
	else
	{
		$('bunch_form').action=host+"/setup/delete_bunch"
		$('bunch_form').submit();
	}
	}

/* Adviser Academy */
/* Start Registration JS for Adviser Academy */
function register_validation_for_adviser()
{
    if($('user_firstname').value=="")
	{
		alert("Please enter the First Name");
		$('user_firstname').focus();
		return false;
	}
	if($('user_lastname').value=="")
	{
		alert("Please enter the Last Name");
		$('user_lastname').focus();
		return false;
	}
	
	if($('user_email').value=='' )
	{
		alert("Please enter the Email.");
		$('user_email').focus();
		return false;	
	}
	
	if($('user_email').value!="")
	 {
	  var value1 =$('user_email').value;
	  var matchArray=value1.match(/^(.+)@(.+)\.(.+)$/)
		if (matchArray == null)
		 {
			 alert("Incorrect Email format: " +value1);
			 $('user_email').focus();
			 return false;
		 }
	 }
	
	if($('user_email').value!=$('confirm_email').value)
	{
		alert("The Email addresses do not match.");
		return false;	
	}
	 
	return chk_pwd_for_adviser($('user_password').value,$('password_confpass').value) 
	
	
	
}


function chk_pwd_for_adviser(user_password,password_confpass)
{

	if($('user_password').value==''  )
	{
		alert("Please enter New Password.");
		return false;
	}
	if(containSpecialChar_for_adviser($('user_password').value))
	{
		alert("Special characters are not allowed in password.");
		return false;
	}
	if($('user_password').value.length<8)
	{
		alert("The password must at least be 8 characters long.\nThis password does not meet the minimum requirements.");
		return false;	
	}
	if(!validate_for_adviser($('user_password').value))
	{
		alert("The password must at least be 8 characters long and contain one number.\nThis password does not meet the minimum requirements.");
		return false;	
	}
	if($('user_password').value!=$('password_confpass').value)
	{
		alert("The Passwords do not match.");
		return false;	
	}

	if($('user_password').value==$('user_email').value)
	{
		alert("Password and Email can not be same ");
		return false;
	}
 	if($('user_company_name').value=="")
	{
		alert("Please enter company name");
		$('user_company_name').focus();
		return false;	
	}

}


function containSpecialChar_for_adviser(strvalue)
{
	spcchar=new Array(".","~","!","@","#","$","%","^","&","*","_","+","|","\\","//","/","\"");
	for (i=0; i<spcchar.length; i++)
	{
		if (strvalue.indexOf(spcchar[i])!= -1)
		{
			return true;
		}
	}

	return false;
}

function validate_for_adviser(val)
{
	var countUpper=0;
	var countLower=0;
	var countNum=0;

	for(i=0;i<val.length;i++)
	{
		if(isNaN(val.charAt(i)))
		{
			/*if(val.charAt(i)==(val.charAt(i)).toLowerCase())
			countLower++;	
			if(val.charAt(i)==(val.charAt(i)).toUpperCase())
			countUpper++;*/	
		}
		else
		countNum++;
	}
	
	
 	//if(countLower > 0 && countUpper > 0 && countNum > 0)
	if(countNum > 0)
	return true;
	else
	return false;
	
}

/*function password_check_adviser(host_name){
    if ($('user_password').value == "" || $('user1_password_confirmation').value == "") {
        alert("Please Enter New Password")
    }
     if ($('user_password').value != $('user1_password_confirmation').value || $('user_password').value.length < 8) {
            alert("The password must at least 8 characters long, using a mixture of upper and lower case characters and atleast one number.This password does not meet the minimum requirements")
        }
        else {
            document.forms[0].action = host_name + "/user/update_password"
            document.forms[0].submit()
        }
}*/

 function password_check_adviser(host_name)
{
 if($('user_password').value=='' ){
 alert("Please enter New Password.");
 return false;
 }else if(containSpecialChar_for_adviser($('user_password').value) ){
 alert("Special characters are not allowed in password.");
 return false;
 }
 else if($('user_password').value.length<8)
 {
 alert("The password must at least 8 characters long.\nThis password does not meet the minimum requirements.");
 return false;
 }
 else if(!validate_for_adviser($('user_password').value))
 {
 alert("The password must at least 8 characters long and contain one number.\nThis password does not meet the minimum requirements.");
 return false;
 }
 else if($('user_password').value!=$('user1_password_confirmation').value){
 alert("The Passwords do not match.");
 return false;
 }
 else if($('user_password').value=='suraj@cift.com')
 {
 alert("Password and Email can not be same ");
 return false;
 }
    alert('Your password has been has been changed');
    $('password_check').action = host_name + "/user/update_password?newpass=" + $('user_password').value
    $('password_check').submit();
}

/* End Registration JS for Adviser Academy */
/* Tool Tip Start */




function hideToolTip()
{

 document.getElementById('bubble_tooltip').style.display = 'none';

}

function hideToolTip1(id)
{

 document.getElementById('help_bubble_tooltip').style.display = 'none';
}
function hideToolTip2(id)
{

 document.getElementById('opt_bubble_tooltip').style.display = 'none';
}



var thread1=null;
var thread2=null;
var thread3=null;

function showToolTip(e,e_name,e_city,e_date,e_venue,onOBJ,iframe){

 if(document.all)e = event;
 var obj = document.getElementById('bubble_tooltip');


 //var obj_e_name = document.getElementById('e_name')
 //obj_e_name.innerHTML=e_name;

 var obj_e_city = document.getElementById('e_city')
 obj_e_city.innerHTML=e_city;

 var obj_e_date = document.getElementById('e_date')
 obj_e_date.innerHTML=e_date;

 var obj_e_venue = document.getElementById('e_venue')
 obj_e_venue.innerHTML=e_venue;


 var obj2 = document.getElementById('content');
 var obj3 = document.getElementById('content2');

 onOBJ.bgColor='#E8E8E8'

 //obj2.innerHTML = text;

 /*** IE 6 Fix ****/
 if(iframe==true)
 {
 var cont=createIframe(obj2);
 writeContent(cont,obj3)
 }
 else
 {
 obj2.innerHTML=obj3.innerHTML;
 }

 obj.style.display = 'block';

var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
 if(navigator.userAgent.toLowerCase().indexOf('safari')>=0)st=0;

 var leftPos = e.clientX+10 ;
 if(leftPos < 0)leftPos = 0;
 obj.style.left = leftPos + 'px';
 obj.style.top = e.clientY - obj.offsetHeight -1 + st + 'px';

 if(thread1!=null)clearTimeout(thread1);

}

function showToolTip2(e,summary,e_city,e_date,e_venue,onOBJ,iframe){

 if(document.all)e = event;
 var obj = document.getElementById('bubble_tooltip');

 /*
 var obj_summary = document.getElementById('summary')
 obj_summary.innerHTML=summary;

 var obj_e_city = document.getElementById('e_city')
 obj_e_city.innerHTML=e_city;

 var obj_e_date = document.getElementById('e_date')
 obj_e_date.innerHTML=e_date;

 var obj_e_venue = document.getElementById('e_venue')
 obj_e_venue.innerHTML=e_venue;

*/
 var obj2 = document.getElementById('help_content');
 var obj3 = document.getElementById('help');

 //onOBJ.bgColor='#E8E8E8'

 //obj2.innerHTML = text;

 /*** IE 6 Fix ****/
 if(iframe==true)
 {
 var cont=createIframe(obj2);
 writeContent(cont,obj3)
 }
 else
 {
 obj2.innerHTML=obj3.innerHTML;
 }

 obj.style.display = 'block';
 obj2.style.width='450px'

 var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
 if(navigator.userAgent.toLowerCase().indexOf('safari')>=0)st=0;

 var leftPos = e.clientX-350 ;
 if(leftPos < 0)leftPos = 0;
 obj.style.left = leftPos + 'px';
 obj.style.top = e.clientY - obj.offsetHeight +150 + st + 'px';

 if(thread1!=null)clearTimeout(thread1);

}
function showToolTip3(e,summary,e_city,e_date,e_venue,onOBJ,iframe){

 if(document.all)e = event;
 var obj = document.getElementById('help_bubble_tooltip');


 var obj2 = document.getElementById('help_content');
 var obj3 = document.getElementById('help');


 /*** IE 6 Fix ****/
 if(iframe==true)
 {
 var cont=createIframe(obj2);
 writeContent(cont,obj3)
 }
 else
 {
 obj2.innerHTML=obj3.innerHTML;
 }

 obj.style.display = 'block';
 obj2.style.width='450px'

 var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
 if(navigator.userAgent.toLowerCase().indexOf('safari')>=0)st=0;

 var leftPos = e.clientX-350 ;
 if(leftPos < 0)leftPos = 0;
 obj.style.left = leftPos + 'px';
 obj.style.top = e.clientY - obj.offsetHeight +155 + st + 'px';

 if(thread2!=null)clearTimeout(thread2);

}
function showToolTip4(e,summary,e_city,e_date,e_venue,onOBJ,iframe){

 if(document.all)e = event;
 var obj = document.getElementById('opt_bubble_tooltip');


 var obj2 = document.getElementById('opt_content');
 var obj3 = document.getElementById('opt');
 //var obj4 = document.getElementById('PUT_FRAME');



 /*** IE 6 Fix ****/

 if(iframe==true)
 {
 var cont=createIframe(obj2);
 cont.src='opt_out.jsp';
 cont.style.height = "250px";
 cont.style.width = "450px";
 obj2.style.width='500px'
 //writeContent(cont,obj3)

 }
 else
 {
  obj2.innerHTML=obj3.innerHTML;
 }

 obj.style.display = 'block';


 var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
 if(navigator.userAgent.toLowerCase().indexOf('safari')>=0)st=0;

 var leftPos = e.clientX-350 ;
 if(leftPos < 0)leftPos = 0;
 obj.style.left = leftPos + 'px';
 obj.style.top = e.clientY - obj.offsetHeight +90+ st + 'px';
 //obj.style.top='100px'
 if(thread3!=null)clearTimeout(thread3);

}
/* Tool Tip End */

function validation_for_editprofile()
{
     if($('user_firstname').value=="")
	{
		alert("Please enter the First Name");
		$('user_firstname').focus();
		return false;
	}
	if($('user_lastname').value=="")
	{
		alert("Please enter the Last Name");
		$('user_lastname').focus();
		return false;
	}
	if($('user_company_name').value=="")
	{
		alert("Please enter company name");
		$('user_company_name').focus();
		return false;	
	}
}
/* Adviser Academy */

function emailReport(course_id,host_name)
{
    
   
    emailPopup=window.open("http://192.168.1.199:3000/calyonlondon/user/report_sending","emailPopup","width=370 height=250")
    document.f1.target="emailPopup";
    document.f1.action=host_name+'/user/uda_assigned_users?course='+course_id +'&email_rep='+'true';
    document.f1.submit();


}


	function check_user_fields_admin(host,str)
	{
		var email_regex = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		if($('user_firstname').value == "")
		{
			$('user_firstname').focus();
			alert("Please Enter First Name");
			return false;
		}
		else if($('user_lastname').value == "")
		{
			$('user_lastname').focus();
			alert("Please Enter Last Name");
			return false;
		}
		else if($('user_email').value == "" ||  !email_regex.test($('user_email').value))
		{
			value=$('user_email').value
			$('user_email').value =""
			$('user_email').focus();
			alert("Please Enter Valid Email");
			return false;
		}
//		else if($('user_username').value == "")
//		{
//			$('user_username').focus();
//			alert("Please Enter Login ID");
//			return false;
//		}
		
		else if(str =="yes")
		{
		
		if ($('user_corporate_id').value =="")
		{
			alert("Please Select Corporate");
			$('user_corporate_id').focus();
			return false;			
		}
		
		else if($('user_password').value == "" )
		{
			var status =confirm("You have not entered Password. If you are sure to continue without password Please Press ok")
			if (status !=true)
			{
			$('user_password').focus();
			return false;
			}
		}	
		else if($('user_password').value !="" && $('user_password_confirmation').value == "" )
		{
			$('user_password_confirmation').focus();
			alert("Please Re-Enter Password");
			return false;
		}
		else if ($('user_password').value != $('user_password_confirmation').value )
		{
			alert("Password is not matched");
			$('user_password_confirmation').value="";
			$('user_password_confirmation').focus();
			return false;			
		}
		else if($('user_username').value == "" )
		{
			var status =confirm("You have not entered Login-Id. If you are sure to continue without Login-Id Please Press ok")
			if (status !=true)
			{
			$('user_username').focus();
			return false;
			}
		}
		}
		else
		{
			return true;
		}
	}

function check_all_course()
{
	var check_box = $('course_form').getElements();
	for (var i=0;i<check_box.length;i++)
	{
		if(check_box[i].type =="checkbox")
		{
			check_box[i].checked = true;
		}
	}
}
/////////////////////////////////////////for calyon london/////////////////////////////////////////////////////
function resetACA(userid,fid,status)
{
	if(status=='N' && confirm("Are you sure to reset?"))
	{
		location.href="reset_annual_comliance_affirmation?userid="+userid+"&fid="+fid+"&status="+status;
	}
	else if(status=='C' && confirm("Are you sure to mark read?"))
	{
		location.href="reset_annual_comliance_affirmation?userid="+userid+"&fid="+fid+"&status="+status;
	}

}

function decline_req(email)
{
	if(confirm("Please confirm that you wish to decline the request for an e-learning account by '"+email+"'. This will delete the request from the database and no record will be maintained."))
	{
		document.location.href="decline_request?email="+email;
	}
}
function approve_req(email)
{
		document.location.href="user_form_approve_request?email="+email;

}

function check_fields_for_approve()
{
	if(document.field_check.user_request_accounts_firstname.value=="") {
		alert("Please type first name. This is a required field.");
		document.field_check.user_request_accounts_firstname.focus();
		return false;
	} 
	else if(document.field_check.user_request_accounts_lastname.value=="") {
		alert("Please type last name. This is a required field.");
		document.field_check.user_request_accounts_lastname.focus();
		return false;
	} 
	else if(document.field_check.user_request_accounts_ut_number.value=="") {
		alert("Please type UT Number. This is a required field.");
		document.field_check.user_request_accounts_ut_number.focus();
		return false;
	} 
	else if(document.field_check.user_request_accounts_cost_center.value=="") {
		alert("Please type Cost Centre . This is a required field.");
		document.field_check.user_request_accounts_cost_center.focus();
		return false;
	} 
	else if((document.field_check.user_request_accounts_firstname.value.charAt(0)>='a' && document.field_check.user_request_accounts_firstname.value.charAt(0)<='z') || (document.field_check.user_request_accounts_lastname.value.charAt(0)>='a' && document.field_check.user_request_accounts_lastname.value.charAt(0)<='z')) 
	{
			rfname=document.field_check.user_request_accounts_firstname.value.charAt(0).toUpperCase()+document.field_check.user_request_accounts_firstname.value.substring(1);
			rlname=document.field_check.user_request_accounts_lastname.value.charAt(0).toUpperCase()+document.field_check.user_request_accounts_lastname.value.substring(1);

            if(confirm("Click OK to capitalise the first letter of the Name ("+rfname+" "+rlname+") or Cancel to continue without capitalisation ("+document.field_check.user_request_accounts_firstname.value+" "+document.field_check.user_request_accounts_lastname.value+")"))
			{							
				if(document.field_check.user_request_accounts_firstname.value.charAt(0)>'Z')document.field_check.user_request_accounts_firstname.value=rfname;
				if(document.field_check.user_request_accounts_lastname.value.charAt(0)>'Z')document.field_check.user_request_accounts_lastname.value=rlname;
			}
	}
}

function cancel_proving_request() {
		document.location.href="pending_request_list"
}
//////////////////////////////////////for calyon london end//////////////////////////////////////////////////
function show_result_test_diagonstics(host_name) {
	    $('activity_summary').action=host_name+'/user/test_diagnostics'
		$('activity_summary').submit();
}

function show_result_test_diagonstics_london(host_name) {
	    $('activity_summary').action=host_name+'/user/test_diagonastic_london'
		$('activity_summary').submit();
}

function show_result_course_london(host_name) {
	    $('activity_summary').action=host_name+'/user/course_report'
		$('activity_summary').submit();
}

function call_uda_report(host_name,course_name)
{
	$('three_module_report').action=host_name+'/user/uda_assigned_users'
	$('three_module_report').submit();
}

function batch_name_check()
{
	if(document.f1.batches_name.value=="")
	{
		alert("Please enter the Batch Name.");
		return false;
	}
	
}

function send_email_to_users(host_name)
{
	$('form_emails').action=host_name+'/user/email_formats_send'
	$('form_emails').submit();
}

function reset_the_form()
{
	document.location.href="email_users_main"
}

function back_after_email_send(host_name)
{
	$('email_users').action=host_name+'/user/email_formats_send'
	$('email_users').submit();
}
////////////////////////////////////////////////////for set notification new/////////////////////////////////////
function render_to_update_notification(user_id)
{
	//$('my_form').action='/user/create_notification'
	$('my_form').submit();
	pause(2000);
	opener.location.href="update_notification?user_id="+user_id;
	window.close();
}

function editNoticeEmail(user_id,notice_opt,email,host_name)
	{
	    window.open(host_name + "/user/edit_emails_set_notification?user_id="+user_id+"&notice_opt="+notice_opt+"&email="+email, "", "toolbars=no, width=550, height=400");
	}


function checkValueEmail(host_name){
     if(document.edit_email.edit_email.value!=""){
	  var value1 =document.edit_email.edit_email.value;
	  var matchArray=value1.match(/^(.+)@(.+)\.(.+)$/)
    		if (matchArray == null){
				 alert("Invalid email ID:: " +value1);
				 document.edit_email.edit_email.value="";
				 document.edit_email.edit_email.focus();
				 return false;				
    		}
	}else{
		alert("Please enter email ID");
		document.edit_email.edit_email.focus();
		return false;
	}
	$('edit_email').action=host_name +'/user/update_edited_email_set_notification'
	$('edit_email').submit();
	pause(1000);
	opener.location.reload();
    window.close();
}

  /*var submitcount=0;
  function isSubmitted(){
	   if (submitcount == 0){
			  submitcount++;
			  return true;
		}else{
			  alert("Your request is being submitted, Please wait!. Thanks!");
			  return false;
		}
  }*/
////////////////////////////////////////////////////for set notification end/////////////////////////////////////
function submit_sort_lp_report(host_name,sort_value,sort_order)
{


	$('sort_by').value = sort_value
	$('sort_order').value = sort_order
	  report_height();
	$('sort_form').action=host_name+'/user/report_generate'

	$('sort_form').submit();

}

function edit_profile_deatils(host)
{
	$('report').action=host+'/user/edit_user_details'
	$('report').submit();
}

function check_fields_user_details(host_name,condn)
{
	if(condn == 'check')
	{
    	if($('first_name').value == "")
    	{
    		alert("Please Enter First Name");
    		$('first_name').focus();
    		return false;
    	}
    	else if($('last_name').value == "")
    	{
    		alert("Please Enter Last Name");
    		$('last_name').focus();
    		return false;
    	}
    	else if($('email').value == "")
    	{
    		alert("Please Enter Email");
    		$('email').focus();
    		return false;
    	}
    	else if($('country').value == "")
    	{
    		alert("Please Enter Location");
    		$('country').focus();
    		return false;
    	}
    	else if($('department').value == "")
    	{
    		alert("Please Enter Department");
    		$('department').focus();
    		return false;
    	}
    	else
    	{
    		$('edit_form').action=host_name+"/user/update_user_detail"
    		$('edit_form').submit();
    	}
		
	}
	else
	{
		$('edit_form').action=host_name+"/user/edit_user_details"
		$('edit_form').submit();
	}
}


function check_previous()
{
	var status = $$("form#edit_form >table>tbody>tr>td>input[type='text']").length
	if(status == 5)
	{
		alert("Please Finish Previous Request \n\n [ Edit Profile: " + $('first_name').value + ' ' + $('last_name').value + "]");
		return false;
	}
	else
	{
		return true;
	}
}


function change_sort_order(host,drop_down,order,drop_down_value)
{
	
	if(drop_down == 'first')
	{
		$('filter_first').value = drop_down_value
		$('first_order').value = order;
			$('report_course').action = host+"/user/specific_course_report_westlb"
	$('report_course').submit();
	}
	else if(drop_down == 'second') 
	{
		$('second_order').value = order
		$('report_course').action = host+"/user/specific_course_report_westlb"
	$('report_course').submit();
	}
}

function year_review_report(host_name)
{
	$('report').action=host_name+"/user/year_review_report"
	$('report').submit();
}

function german_report(host_name)
{
	$('report').action=host_name+"/user/report_compaml"
	$('report').submit();
}

function report_compaml(host_name)
{
	$('report').action=host_name+"/user/report_compaml"
	$('report').submit();
}

function check_confirm(host_name,q_length)
{
	if($('confirm').checked == false)
	{
		alert("Please confirm that you have read, understood and are in compliance with the provisions of the Compliance Manual.");
		return false;
	}
	
	for (i=1;i<=q_length;i++)
	{
		if ($('affirmation_ans'+i).value == "Select") {
			alert('Please ensure you have answered all the questions on this form.');
			return false;
		}
	}
}


function check_confirm_new(host_name,q_length)
{
		
	rad1=document.confirm_affirmation.ans1
	if (rad1[0].checked == false && rad1[1].checked == false)
		{
				alert('Please ensure you have answered all the questions on this form.');
				return false;
		}
	rad2=document.confirm_affirmation.ans2
	if (rad2[0].checked == false && rad2[1].checked == false)
		{
				alert('Please ensure you have answered all the questions on this form.');
				return false;
		}
	rad3=document.confirm_affirmation.ans3
	if (rad3[0].checked == false && rad3[1].checked == false)
		{
				alert('Please ensure you have answered all the questions on this form.');
				return false;
		}
	rad4=document.confirm_affirmation.ans4
	if (rad4[0].checked == false && rad4[1].checked == false)
		{
				alert('Please ensure you have answered all the questions on this form.');
				return false;
		}
	rad5=document.confirm_affirmation.ans5
	if (rad5[0].checked == false && rad5[1].checked == false && rad5[2].checked == false)
		{
				alert('Please ensure you have answered all the questions on this form.');
				return false;
		}
	rad19=document.confirm_affirmation.ans19
	if (rad19[0].checked == false && rad19[1].checked == false)
	{
		alert('Please ensure you have answered all the questions on this form.');
		return false;
	}
	else if (rad19[0].checked == true && rad19[1].checked == false) 
	{
		rad6 = document.confirm_affirmation.ans6
		if (rad6[0].checked == false && rad6[1].checked == false) {
			alert('Please ensure you have answered all the questions on this form.');
			return false;
		}
		rad7 = document.confirm_affirmation.ans7
		if (rad7[0].checked == false && rad7[1].checked == false) {
			alert('Please ensure you have answered all the questions on this form.');
			return false;
		}
		rad8 = document.confirm_affirmation.ans8
		if (rad8[0].checked == false && rad8[1].checked == false) {
			alert('Please ensure you have answered all the questions on this form.');
			return false;
		}
		rad9 = document.confirm_affirmation.ans9
		if (rad9[0].checked == false && rad9[1].checked == false) {
			alert('Please ensure you have answered all the questions on this form.');
			return false;
		}
		rad10 = document.confirm_affirmation.ans10
		if (rad10[0].checked == false && rad10[1].checked == false) {
			alert('Please ensure you have answered all the questions on this form.');
			return false;
		}
		rad11 = document.confirm_affirmation.ans11
		if (rad11[0].checked == false && rad11[1].checked == false) {
			alert('Please ensure you have answered all the questions on this form.');
			return false;
		}
		rad12 = document.confirm_affirmation.ans12
		if (rad12[0].checked == false && rad12[1].checked == false) {
			alert('Please ensure you have answered all the questions on this form.');
			return false;
		}
		rad13 = document.confirm_affirmation.ans13
		if (rad13[0].checked == false && rad13[1].checked == false) {
			alert('Please ensure you have answered all the questions on this form.');
			return false;
		}
		rad14 = document.confirm_affirmation.ans14
		if (rad14[0].checked == false && rad14[1].checked == false) {
			alert('Please ensure you have answered all the questions on this form.');
			return false;
		}
		rad15 = document.confirm_affirmation.ans15
		if (rad15[0].checked == false && rad15[1].checked == false) {
			alert('Please ensure you have answered all the questions on this form.');
			return false;
		}
		rad16 = document.confirm_affirmation.ans16
		if (rad16[0].checked == false && rad16[1].checked == false) {
			alert('Please ensure you have answered all the questions on this form.');
			return false;
		}
		rad17 = document.confirm_affirmation.ans17
		if (rad17[0].checked == false && rad17[1].checked == false && rad17[2].checked == false) {
			alert('Please ensure you have answered all the questions on this form.');
			return false;
		}
	}
	
	rad18 = document.confirm_affirmation.ans18
	if (rad18[0].checked == false && rad18[1].checked == false) {
			alert('Please ensure you have answered all the questions on this form.');
			return false;
	}
	
	if($('confirm1').checked == false || $('confirm2').checked == false)
	{
		alert("Please confirm that you have read, understood and are in compliance with the provisions of the Compliance Manual.");
		return false;
	}
}


function check_confirm_new_Cheuvreux(host_name,q_length)
{
	
	if ($('confirm').checked == false) 
	{
		alert("Please confirm that you have read, understood and are in compliance with the provisions of the Compliance Manual.");
		return false;
	}

	rad1=document.confirm_affirmation.ans1
	if (rad1[0].checked == false && rad1[1].checked == false)
		{
				alert('Please ensure you have answered all the questions on this form.');
				return false;
		}
		
	rad2=document.confirm_affirmation.ans2
	if (rad2[0].checked == false && rad2[1].checked == false)
		{
				alert('Please ensure you have answered all the questions on this form.');
				return false;
		}
		
	rad3=document.confirm_affirmation.ans3
	if (rad3[0].checked == false && rad3[1].checked == false)
		{
				alert('Please ensure you have answered all the questions on this form.');
				return false;
		}
		
	rad4=document.confirm_affirmation.ans4
	if (rad4[0].checked == false && rad4[1].checked == false && rad4[2].checked == false)
		{
				alert('Please ensure you have answered all the questions on this form.');
				return false;
		}
		
	rad5=document.confirm_affirmation.ans5
	if (rad5[0].checked == false && rad5[1].checked == false && rad5[2].checked == false)
		{
				alert('Please ensure you have answered all the questions on this form.');
				return false;
		}
		
}

function check_group_name()
{
	if($('rollout_group_name').value=="")
	{
		alert("Please Enter Group Name");
		$('rollout_group_name').focus();
		return false;
	}
}

function vaildated_the_presence_of_title_and_question()
{
	if ($('forum_question_question_title').value=="")
		{
			alert("Please enter Topic/Question.");
			$('forum_question_question_title').focus();
			return false;
		}
	else if ($('forum_question_question').value=="")
		{
			alert("Please enter Topic/Question.");
			$('forum_question_question').focus();
			return false;
		}
}

function popup_lms(url)
{

 params  = 'width='+screen.width;
 params += ', height='+screen.height;
 params += ', top=0, left=0'
 params += ', fullscreen=no'
 params += ', status=yes'
 params += ', resizable=yes';
 
 newwin=window.open(url,'windowname4', params);
 if (window.focus) {newwin.focus()}
 return false;
}

//////////////////////////////////////////////////////for advanced report//////////////////////

function checkField1(e){return checkField(e,1)}
function checkField2(e){return checkField(e,2)}
function checkField3(e){return checkField(e,3)}
function checkField4(e){return checkField(e,4)}

function checkField(e,fieldno)
{
    //alert(window.event.keyCode)

	if( window.event)
	{
		keynum=window.event.keyCode
	}
	else if(e.which)
	{
		 keynum = e.which;
	}
			 
	if(keynum==8 || keynum==9 || keynum==46 || keynum==37 || keynum==38 || keynum==39 || keynum==40)
	{
		return true;
	}


	field=eval("document.filterform.phase"+fieldno)
	if(field.selectedIndex==0)
	{
		alert("Please select the field first.");
		field.focus();
		return false;
	}
}
//////////////////////////////////////////////////////for advanced report END//////////////////////
///////////////////for session expiry///////////////////////////////////////////////////
function session_log(id)
	{
		if ($(id).innerHTML.match("Login"))
    		{
	 			$(id).style.display='none';
                window.location.reload();
            }
    }
///////////////////for session expiry end///////////////////////////////////////////////////
function answer_check()
{

	if(document.answer_edit.forum_answer_answer.value=="" )
	{
		alert("Please enter Answer.");
		return false;
	}
}


var navigation_no=0;


function check_dropdown_value(drop_down_id,txt_fld_id)
{
    if($(drop_down_id).value == '--')
        {
           
        alert('Please Select the field first');
        $(txt_fld_id).value =""
        $(drop_down_id).focus();
    }
}

function preview_from_template(host_name)
{
   var target = document.getElementById("preview");
   target.setAttribute("target", "popup");
   target.setAttribute("action", "/user/preview_partial_page");
  OpenWin = this.open("preview", "popup", "toolbar=no,menu=no,resizable=no,scrollbars=yes, status=no,width=600,height=550,top=100,left=100");
   target.submit();
} 

function display_please_state()
{
   if($('typeoforganisation').value =='Other')
       {
       $('state_id').show();
   }
   else
       {
           $('state_id').hide();
   }
} 

function show_mod(t,pc)
{
	//alert('child_'+t)
	new Ajax.Updater('child_'+t, '/calyonasia/user/show_modules?pc_id='+pc+'&visible=true&rand='+Math.random(), {asynchronous:true, evalScripts:true, onComplete:function(request){Element.hide('indicator_'+t);}, onLoading:function(request){Element.show('indicator_'+t)}});
	Element.toggle('child_'+t)
	Element.toggle('plus'+t)
	Element.toggle('minus'+t)
}


function showProgressBar(cid)
{
//    alert(cid);
    elem=$(cid)
	elem.innerHTML="<div align='left'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img alt='Indicator' id='indicator' src='/images/calyon_new_images/indicator.gif' /></div>";
	//    alert(elem);
}

function corporate_field_check()
{
   if (($('corporate_id').value == '') || ($('corporate_id').value == 'Please select the corporate'))
   {
    alert('Please select the corporate');
    return false;
   }
}

function text_value_check(e)
{
if(e.keyCode>=48 && e.keyCode<=57 || e.keyCode==8)
{
    return true;
}
else
{
 return false;
}
}

function check_text_box1(field){return clear_text_box(field)}
function check_text_box2(field){return clear_text_box(field)}
function check_text_box3(field){return clear_text_box(field)}
function check_text_box4(field){return clear_text_box(field)}

function clear_text_box(field)
{
  if ($('phases'+field).value=="--")
     {
        $('user_select'+field).value=""       
      }
    
}

function validateSaveCustomReport() {
	if($("customized_report_report_name").value == "") {
		alert("Please provide a report name.");
		return false;
	}
}


function for_my_team_lp_report(name,host,lpc,completed)
{
	$(name).action = host+"/user/my_team_to_lp_report?"+"lpc_id="+lpc+"&completed="+completed
	$(name).submit();
}


function for_myteam_lp_report(host)
{
var lpc = $('lpc_id').value;
var completed = $('completed').value;
$('sort_order').value = $('filter_first').value;
$('report_course').action = host+"/user/my_team_to_lp_report?"+"lpc_id="+lpc+"&completed="+completed
$('report_course').submit();
}

function change_sort_order_my_team_lp_report(host,order,sort_value)
{
$('sort_order').value = sort_value;
$('order').value = order;
$('report_course').action = host+"/user/my_team_to_lp_report"
$('report_course').submit();
}

function send_myteam_report(host,for_whom)
{
   if(for_whom =='myself' )
   {
       $('to').value = 'myself';
       $('report_confirm_myteam').action=host+"/user/my_team_to_lp_report"
       $('report_confirm_myteam').submit();
   }
   if(for_whom =='to_all' || for_whom =='to_selected' )
   {
       document.report_confirm.to.value = for_whom;
       $('report_confirm').action=host+"/user/my_team_to_lp_report"
       $('report_confirm').submit();
   }
   if(for_whom =='to_group')
   {
           document.report_confirm.to.value = for_whom;
       $('report_confirm').action=host+"/user/my_team_to_lp_report_group_users"
       $('report_confirm').submit();
   }
  }


function for_my_team_lp_report(name,host,lpc,completed)
{
  $(name).action = host+"/user/my_team_to_lp_report?"+"lpc_id="+lpc+"&completed="+completed
  $(name).submit();
}

function check_users_my_team_report()
{
	checked_elements = $('report_confirm').select('input:checked');
	if(checked_elements.size()==0)
	{
		alert("You have not selected any user to recieve this report!");
		return false;
	}
} 

function check_enquiery_form(host){
   var email_regex = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
     $('country_value').value = $('country').options[$('country').selectedIndex].text;    $('telephone').value = "+"+$('country').value;

       if ($('firstname').value == '') {
           alert('Please enter First Name');
           $('firstname').focus();
           return false;
       }
                  if ($('lastname').value == '') {
               alert('Please enter Last Name');
               $('lastname').focus();
               return false;
           }
                        if ($('jobtitle').value == '') {
                   alert('Please enter Job title');
                   $('jobtitle').focus();
                   return false;
               }
                                  if ($('typeoforganisation').value == 'Other' && $('state').value == '') {
                       alert('Please State Type of organisation');
                       $('state').focus();
                       return false;
                   }
                                          if ($('hear_about').value == 'Other' && $('state1').value == '') {
                           alert('Please State How did you hear about us?');
                           $('state1').focus();
                           return false;
                       }
                                                  if ($('department').value == '') {
                               alert('Please enter Department');
                               $('department').focus();
                               return false;
                           }
                                                          if ($('company').value == '') {
                                   alert('Please enter Company');
                                   $('company').focus();
                                   return false;
                               }
                                                                  if ($('city').value == '') {
                                       alert('Please enter City');
                                       $('city').focus();
                                       return false;
                                   }
                                                                          if ($('country').value == '') {
                                           alert('Please enter country');
                                           $('country').focus();
                                           return false;
                                       }
                                                                                  if ($('email').value == '') {
                                               alert('Please enter valid Email');
                                               $('email').focus();
                                               return false;
                                           }
                                                                                          if ($('telephone').value == '') {
                                                   alert('Please enter Telephone');
                                                   $('telephone').focus();
                                                   return false;
                                               }
                                                                                                  if ($('typeoforganisation').value == '') {
                                                       alert('Please enter Type of organisation');
                                                       $('typeoforganisation').focus();
                                                       return false;
                                                   }
                                                                                                          if ($('typeoforganisation').value == "Other" && $('state').value == '') {
                                                           alert('Please enter State');
                                                           $('state').focus();
                                                           return false;
                                                       }
                                                                                                                  if ($('state01').checked == false && $('state02').checked == false) {
                                                               alert('Please indicate whether you are looking for training services for yourself personally or if your enquiry is part of a larger corporate interest.');
                                                               return false;
                                                           }                                                                                                                                                                                    if ($('interested01').checked == false && $('interested02').checked == false && $('interested03').checked == false) {
                                                                                                                                                                                                                  alert('Please indicate whether you are interested in classroom training services, online training or both.');
                                                                   return false;
                                                               }
                                                                                                                                  if ($('topics').value == '') {
                                                                       alert('Please list the topics you are interested in');
                                                                       $('topics').focus();
                                                                       return false;
                                                                   }
                                                                                                                                          if ($('training_type').value == '') {
                                                                           alert('Please select training type');
                                                                           $('training_type').focus();
                                                                           return false;
                                                                       }
                                                                                                                                                  if ($('hear_about').value == '') {
                                                                               alert('Please answer How did you hear about us?');
                                                                               $('hear_about').focus();
                                                                               return false;
                                                                           }
                                                                              if ($('hear_about').value == 'Google search' || $('hear_about').value == 'Yahoo search') {
                                                                                   if ($('search_word').value == '' || $('search_word').value == "(what search words?)") {
                                                                                       alert('Please Enter Search Word');
                                                                                       $('search_word').focus();
                                                                                       return false;
                                                                                   }
                                                                                   }
                                                                                    if ($('option01').checked == false && $('option02').checked == false) {
                                                                                               alert('Please answer would you like to receive the monthly CIFT newsletter?');
                                                                                               return false;
                                                                                           }
                                                                                            if (!email_regex.test($('email').value)) {
                                                                                                   alert('Please Enter Valid Email');
                                                                                                   $('email').focus();
                                                                                                   return false;
                                                                                               }
                                                                           
                                                                            
}

function fill_extention()
{
   if($('country').value =='')
   {
   $('country_value').value = $('country').options[$('country').selectedIndex].text;    $('telephone').value ='';
   }
   else
   {
   $('country_value').value = $('country').options[$('country').selectedIndex].text;    $('telephone').value = "+"+$('country').value;
   }
} 

function display_search_word(){
   if ($('hear_about') != null) {
       if ($('hear_about').value == 'Google search' || $('hear_about').value == 'Yahoo search') {
           $('search').show();
           $('state_id1').hide();
       }
       else
           if ($('hear_about').value == 'Other') {
               $('search').hide();
               $('state_id1').show();
           }
           else {
               $('search').hide();
               $('state_id1').hide();
           }
   }
}

function event_check_fields()
	{
		var text_area_elements = $$('#event_form>div>div>div>p textarea:even')
		var count = 0;
	    var email_regex = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		for (var i=0;i<=text_area_elements.length-1;i++)
		{
			if (text_area_elements[i].value !="")
			{
				var email_inputs = text_area_elements[i].value.split(',')
				for (var z=1;z<=email_inputs.length;z++)
				{
				if(!email_regex.test(email_inputs[z].value))
				{
					text_area_elements[i].focus();
					alert("Please Enter Valid Email Id");
					return false;
					break;
				}
				else
				{
					count= count+1;
				}
				}
			}
		}
		if(count == 0)
		{
			alert("Please Enter Email Address");
			return false;
		}
	}
	
	
	
	
function check_exempt_user(host)
	{
		var t = $$("form#course_form > table > tbody >tr >td > input[type='checkbox']")
		var count = 0;
		for( var i=0;i<= t.length-1;i++ )
		{
			if (t[i].checked == true)
			{
				count= count+1;
			}
		}
		if (count == 0)
		{
			alert("Please select atleast one checkbox");
			return false;
		}
		else
		{
		var status = confirm("Are you sure?")
		if (status != true)
		{
			return false;
		}
		}

	}

function admin_and_exempt_users(host_name)
{
	$('report').action = host_name + "/user/admin_and_exempt_users"
    $('report').submit();
}	

function oracle_restrict_and_exempt_users(host_name)
{
    $('oracle_report').action = host_name + "/user/oracle_report"
    $('oracle_report').submit();
}