/* ################################################################################
*
* - common.js -
*
################################################################################ */



$(function(){
    $('.clickableArea').each(function() {
        $(this).click(function() {
            location.href = $('a',this)[0].href;
        });
    });
    $('.clickableArea', '#blockClub').each(function() {
        $(this).hover(function(e) {
            //change the background image to contClub.
            var node = e.currentTarget;
            var cnt = 0;
            while( node.className.indexOf('contClub') <= -1 ) {
                node = node.parentNode;
                cnt++;
                if( cnt >= 100 ) break;
            }
            $(node).css('background-image', $(node).css('background-image').replace(/(?:_o)?(\.\w+"?\))$/,'_o$1'));
            //change the photo.
            $('.phMainChar p', this).css({ 'bottom': 0, 'top': 'auto' });
            $('.btnShowClub img', this)[0].src = $('.btnShowClub img', this)[0].src.replace(/\.\w+$/, '_o$&');
        }, function(e) {
            //change the background image to contClub.
            var node = e.currentTarget;
            var cnt = 0;
            while( node.className.indexOf('contClub') <= -1 ) {
                node = node.parentNode;
                cnt++;
                if( cnt >= 100 ) break;
            }
            $(node).css('background-image', $(node).css('background-image').replace(/(?:_o)(\.\w+"?\))$/,'$1'));
            //change the photo.
            $('.phMainChar p', this).css({ 'top': 0, 'bottom': 'auto' });
            $('.btnShowClub img', this)[0].src = $('.btnShowClub img', this)[0].src.replace(/(?:_o)(\.\w+)$/, '$1');
        });
    });
});



//--------------------------------------------------
//
// - wrapepr corner -
//
//--------------------------------------------------
function initWrapeprCorner()
{
	$( "#wrapper" ).append(
		"<div class='wrapperCorner lb png'></div>"
	).append(
		"<div class='wrapperCorner rb png'></div>"
	);
}
//
$( document ).ready( initWrapeprCorner );

//--------------------------------------------------
//
// - drop shadow -
//
//--------------------------------------------------
function initDopShadow()
{
	var _obj = $( ".shadow" );
	
	_obj.css( {
		backgroundColor	:'#000000',
		borderColor			:'#ffffff'
	} );
	
	_obj.dropShadow( {
		left		:1,
		top			:1,
		opacity	:0.4,
		blur		:2
	} );
}
//
$( document ).ready( initDopShadow );

//--------------------------------------------------
//
// - reset floating last element -
//
//--------------------------------------------------
function initResetLastElement()
{
	$( ".resetElem *:last-child" ).css( {
		borderRight: 'none'
	} );
}
//
$( document ).ready( initResetLastElement ) ;

//--------------------------------------------------
//
// - enquete report last table -
//
//--------------------------------------------------
$( function(){
	$( "#groupReport table:last-child" ).addClass( "last" );
} )

//--------------------------------------------------
//
// - frame answerPoint -
//
//--------------------------------------------------
$( function(){
	$( ".answerPoint" ).append(
		"<div class='answerPointFrame lt png'></div>"
	).append(
		"<div class='answerPointFrame rt png'></div>"
	).append(
		"<div class='answerPointFrame lb png'></div>"
	).append(
		"<div class='answerPointFrame rb png'></div>"
	);
} )

