/*
  @project  CreativeConstructor 2.0 jQuery prograssive enhancement
  @name jquery.page.js
  @author lukasz.tyrala
  @version  0.1
  @description  Requires jQuery (1.3+ branch recomended)
*/

jq(document).ready(function(){

  jq(".flash").click(function(){
    jq(this).slideUp();
  });

  jq('.error_list li').wrapContent('inner');
  jq('#register_birthdate_day').parent().addClass('register-birthdate');   
  
  // Messages
  jq('.pagination .select-all').click(function() {
  	jq('#msg-list input').attr('checked', 'checked');
  	return false;
  });
  jq('.pagination .deselect-all').click(function() {
  	jq('#msg-list input').attr('checked', '');
  	return false;
  });  
  
  // setProfile
  jq('.required label').append("<em>*</em>");  
  
  // Default login and apssword
  var 	LOGIN = 'Benutzername', 
  		PASS = 'Passwort';
  
  	// Login
  	jq('#LoginBox #user_login').attr('value', LOGIN);
  	jq('#LoginBox #user_login').focus(function() {
  		if ($(this).attr('value') == LOGIN)
			$(this).attr('value', '');
  	});
  	$('#LoginBox #user_login').blur(function() {
	 	if ($(this).attr('value') == '')
			$(this).attr('value', LOGIN);
	});
	
  	// Password
  	jq('#LoginBox #user_password').attr('value', PASS);
  	jq('#LoginBox #user_password').focus(function() {
  		if ($(this).attr('value') == PASS)
			$(this).attr('value', '');
  	});
  	$('#LoginBox #user_password').blur(function() {
	 	if ($(this).attr('value') == '')
			$(this).attr('value', PASS);
	});
  
  
  /**
   * Global handler for ajax unauthorized responses
   */
  jq(this).ajaxComplete(function(event, request, options){
    if(request.status == 403) window.location = window.location
  });

}); // /document.ready


/**
 * jCarousel
 
tb_pathToImage = "images/loading-thickbox.gif";
		
function mycarousel_itemLoadCallback(carousel, state)
{
    for (var i = carousel.first; i <= carousel.last; i++) {
        if (carousel.has(i)) {
            continue;
        }

        if (i > mycarousel_itemList.length) {
            break;
        }

        // Create an object from HTML
        var item = jQuery(mycarousel_getItemHTML(mycarousel_itemList[i-1])).get(0);

        // Apply thickbox
        tb_init(item);

        carousel.add(i, item);
    }
}
*/
