$(document).ready(function(){   


    $('.header .menu UL LI').hover(function(){
        $(this).addClass('select');
    }, function(){
        $(this).removeClass('select');
    });
    
	/*
    $('.view-elem .close').click(function(){
        if($(this).hasClass('open')){
            $(this).parent().find('span').html('+');
            $(this).removeClass('open');
            $('.hiden-elem').hide();
        } else {
            $(this).parent().find('span').html('-');
            $(this).addClass('open');
            $('.hiden-elem').show();
        }
    });
	*/

	$('.view-elem').click(function(){
		var classnum = $(this).children().find('a').attr('class');

		if($(this).hasClass('open')){
            $(this).children().find('span').html('+');
            $(this).removeClass('open');
            $('.sub_'+classnum).hide();
//alert("##");
        } else {
            $(this).children().find('span').html('-');
            $(this).addClass('open');
            $('.sub_'+classnum).show();
//$("#sidebar").hide();
//alert("!!");
        }
	});
    
    
/*    if ($('#tooltip').html() == ''){
        $('#tooltip').load('/cydec/help/ajax-help.php?url='+window.location.href, function (){
            $('.form select, .form input, .form textarea').each(function(){
                var content = 'No data';
                if ($('#tooltip DIV#hint_'+$(this).attr('name')).size() > 0){
                    content = $('#tooltip DIV#hint_'+$(this).attr('name')).html();
                } 
                $(this).qtip({
                    content: content,
                    position: {
                        corner: {
                           tooltip: 'leftMiddle',
                           target: 'rightMiddle'
                        }
                    },
                    show: { when: { event: 'focus' } },
                    hide: { when: { event: 'blur' }},
                    style: {
                        border: {
                            width: 5,
                            radius: 10,
                            color: '#FF7A00'
                        },
                        classes: {
                            content: 'help-tip'
                        },
                        padding: 3, 
                        textAlign: 'center',
                        tip: true, // Give it a speech bubble tip with automatic corner detection
                        name: 'cream' // Style it according to the preset 'cream' style
                    }
                });
            });
        });
    }*/

});
function setCookie(c_name,value,exdays)
{
  var exdate=new Date();
  exdate.setDate(exdate.getDate() + exdays);
  var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
   document.cookie=c_name + "=" + c_value;
}
function getCookie(c_name)
{
var i,x,y,ARRcookies=document.cookie.split(";");
for (i=0;i<ARRcookies.length;i++)
{
  x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
  y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
  x=x.replace(/^\s+|\s+$/g,"");
  if (x==c_name)
    {
    return unescape(y);
    }
  }
}
function setWelcome(userid,welcome)
{
    $.post("welcome.php", { uid: userid, set: welcome, op: 'welcome_setup' },
   function(data) {

   });
}
