﻿/// <reference name="MicrosoftAjax.js"/>

function changecss(theClass,element,value) {
	//Last Updated on May 21, 2008
	//documentation for this script at
	//http://www.shawnolson.net/a/503/altering-css-class-attributes-with-javascript.html
	 var cssRules;
    
	 if (document.all) {
	  cssRules = 'rules';
	 }
	 else if (document.getElementById) {
	  cssRules = 'cssRules';
	 }
	 
	 var added = false;
	
     if( Sys.Browser.agent == Sys.Browser.Opera)
     {           
	         for (var S = 0; S < document.styleSheets.length; S++)
	         {
	            for (var R = 0; R < document.styleSheets[S].cssRules.length; R++) 
	            {

	                if (document.styleSheets[S].cssRules[R].selectorText == theClass) 
	                {
	                    if(document.styleSheets[S].cssRules[R].style[element])
	                    {
	                        document.styleSheets[S].cssRules[R].style[element] = value;
	                        added=true;
		                    break;
	                    }
	                }
                }	            	          
            }
            
     }else{
       
       	         
	         for (var S = 0; S < document.styleSheets.length; S++)
	         {
	            for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) 
	            {

	                if (document.styleSheets[S][cssRules][R].selectorText == theClass) 
	                {
	                    if(document.styleSheets[S][cssRules][R].style[element])
	                    {
	                        document.styleSheets[S][cssRules][R].style[element] = value;
	                        added=true;
		                    break;
	                    }
	                }
	            }
	         }
    }
        
	  
	if(!added){
	  if(document.styleSheets[S].insertRule){
			  document.styleSheets[S].insertRule(theClass+' { '+element+': '+value+'; }',document.styleSheets[S][cssRules].length);
			} else if (document.styleSheets[S].addRule) {
				document.styleSheets[S].addRule(theClass,element+': '+value+';');
			}
	  }
	
}

function closeFancyBox()
{  
    try
    {
        $j.fn.fancybox.close();    
    }
    catch(err)
    {
    
    }
    
}
