	function star_score(star_nr)
	{	
		for(var i=1; i<=10; i++)
		{
			if(i<=star_nr) document.getElementById('star'+i).style.background = "url(/img/star.gif) no-repeat top left";
			else  document.getElementById('star'+i).style.background = "url(/img/star_white.gif) no-repeat top left";
		}
	}

/*
 	window.onload = function() {
          if(!$.browser.safari) {
          prettyForms();
          }
	}
*/  
 	$(document).ready(function(){

        $('a').focus(function() {
            this.blur();
        });
        
		$.datePicker.setDateFormat('dmy', '-');
		$('input#date1').datePicker();

        //tooltips ---------------
        $('a:not(.nott)').ToolTip(
            {
                className: 'tooltip',
                position: 'mouse',
                delay: 200
             }  
         );       

        $('.score_star').ToolTip(
            {
                className: 'tooltip',
                position: 'mouse',
                delay: 200
             }  
         );  

		if(!$.browser.safari) {
        //init imageBox ---------------
        $.ImageBox.init(
              {
                loaderSRC: '/img/imagebox/loading.gif',
                closeHTML: '<img src="/img/imagebox/close.jpg" style="border:none; margin:0;"/>'
              }
        );
        }

        //Message Box pulsate   -----------------     
        $('#messageBar').Pulsate(300, 3);
        $('#closeMessageBox').Pulsate(300, 3);
        $('#openMessageBox').hide();
        
         //Closing message box ------------------    
        $("#closeMessageBox").click(function(){
             $('#messageBar').slideUp("slow");
             $('#closeMessageBox').hide();
             $('#openMessageBox').show();
        });
        
        //Opening message Box --------------------
        $("#openMessageBox").click(function(){
             $('#messageBar').slideDown("slow");
             $('#openMessageBox').hide();
             $('#closeMessageBox').show();
        });        
        
        //Open/close project post ------------------        
		$("dd:visible:not(.gf)").hide();
		$("dt a.projectopen").click(function(){
			if($(this).parent().parent().next().is(":visible")) {
			$(this).parent().parent().next().slideUp("fast");
			} else {
				$(this).parent().parent().next().slideDown("fast");
			}
			return false;
		});
        
        //open/close boxes ------------------
   		$(".cbplain:not(:first)").hide(); //:not(:first)
   		$(".component h4").next(":not(:first)").hide(); //:not(:first)
   		
        $(".compopen").click(function(){
			if($(this).parent().next().is(":visible")) {
			$(this).parent().next().slideUp("fast");
			} else {
				$(this).parent().next().slideDown("fast");
			}
            return false;
        });
        
        $(".compshoutopen").click(function(){
			if($(this).parent().next().is(":visible")) {
			$(this).parent().next().slideUp("fast");
			} else {
				$(this).parent().next().slideDown("fast");
			}
            return false;
        });
    
		$("#table").tableSorter({
			sortClassAsc: 'headerSortUp',		// Class name for ascending sorting action to header
			sortClassDesc: 'headerSortDown',	// Class name for descending sorting action to header
			headerClass: 'header',			// Class name for headers (th's)
			stripingRowClass: ['even','odd'],	// Class names for striping supplyed as a array.
			highlightClass: 'highlightTable',
			stripeRowsOnStartUp: true		// Strip rows on tableSorter init.
		});    

		$("#table2").tableSorter({
			sortClassAsc: 'headerSortUp',		// Class name for ascending sorting action to header
			sortClassDesc: 'headerSortDown',	// Class name for descending sorting action to header
			headerClass: 'header',			// Class name for headers (th's)
			stripingRowClass: ['even','odd'],	// Class names for striping supplyed as a array.
			highlightClass: 'highlightTable',
			stripeRowsOnStartUp: true		// Strip rows on tableSorter init.
		}); 

		$(".hisearch").focus(function() {
		   if (this.value == "Search")
			 this.value = "";
		 });
		$(".hisearch").blur(function() {
		   if (this.value == "")
			 this.value = "Search";
		 }); 
      

		$("a[@href^='http://']").addClass('ext').attr('target', "_blank");
   
        /*
        $('input').focus(function(){
        	$(this).css({ color: "#880000"});
        }); 
        
        $('input').change(function(){
        	$(this).css({ color: "#000"});
        }); 

        $('textarea').focus(function(){
        	$(this).css({ color: "#880000"});
        }); 
        
        $('textarea').change(function(){
        	$(this).css({ color: "#000"});
        });         
        */
        
        /*$("#headeer").click(function(){
           var sl = (document.getElementById('test').value).substring(document.getElementById('test').selectionStart, document.getElementById('test').selectionEnd);  
           alert(sl);
        });*/

		/*
        $(".layout_right_block h2").click(function(){
            if($(this).next().is(":visible")) {
                $(this).next().slideUp("fast");
            } else {
                $(this).next().slideDown("fast");
            }
            return false;
        });
        */
	});
	
	function copyToClipboard(inElement) {
	  if (inElement.createTextRange) {
	    var range = inElement.createTextRange();
	    if (range && BodyLoaded==1)
	      range.execCommand('Copy');
	  } else {
	    var flashcopier = 'flashcopier';
	    if(!document.getElementById(flashcopier)) {
	      var divholder = document.createElement('div');
	      divholder.id = flashcopier;
	      document.body.appendChild(divholder);
	    }
	    document.getElementById(flashcopier).innerHTML = '';
	    var divinfo = '<embed src="/flash/_clipboard.swf" FlashVars="clipboard='+encodeURIComponent(inElement.value)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
	    document.getElementById(flashcopier).innerHTML = divinfo;
	  }
	}
    
    
