ClicksiaHome = function() {
	var currentSet = 0;
	var timer = 0;
	var hlX = [0, 90, 180, 270];
	var hlY = [0,-100,-200,-300];
	this.changeSet = function(set,hold) {
		currentSet=set;
		if(!hold) {
			clearInterval(this.timer);
			this.timer = setInterval("sh.autoChange()",7000); 
		}
		$("#sh_hl").animate({"marginLeft": hlX[set]},400);
		$("#she_c").animate({"marginTop": hlY[set]},400);
	}
	this.autoChange = function() {
		if(currentSet < 3) this.changeSet((currentSet+1),true);
		else this.changeSet(0,true);
	}
	this.start = function() {
		this.timer = setInterval("sh.autoChange()",5000);
	}
}
var sh = new ClicksiaHome;

$(document).ready(function(){
	sh.start();

	$( 'form' ).submit( function() {
		$( '.pbtn input' ).val( 'Working...' );
		$( '.pbtn input' ).attr( 'disabled', 'disabled' );
		return true;
	});

	$( '.s_tbl tbody tr' ).hover( function() {
		$( this ).addClass( 'hl' );
	}, function() {
		$( this ).removeClass( 'hl' );
	});

	$( '.s_tbl tbody tr' ).click( function() {
		$( this ).siblings( 'tr' ).removeClass( 'chl' );
		$( this ).addClass( 'chl' );
	});
});

function c_ch( elmnt ) /* Captcha Click */
{
	$( '#ht_c' ).val( $( elmnt ).text() );

	$( elmnt ).siblings( 'a' ).removeClass( 'c' ).addClass( 'd' );
	$( elmnt ).removeClass( 'd' ).addClass( 'c' );

	return false;
}

function exma( elmnt )
{
	var dis;

	$( elmnt ).parent( 'li' ).siblings( 'li.ma' ).each( function () {
		dis = $( this ).css( 'display' );
		$( this ).css( 'display', ( dis == 'none' ? 'block' : 'none' ) );
	});
	return false;
}

function pop_it( w, h, t, p )
{
	var een = {
		d: document,
		div: 'div',
		ww: $( 'body' ).width(),
		c_b: function()
		{
			if( $( '#b_h_b' ).length != 0 )
				$( '#b_h_b' ).remove();

			var c = een.d.createElement( een.div );
			var b = een.d.createElement( een.div );

			if( p == 1 )
				$( c ).addClass( 'g_pp_bca rounded' );
			else if( p == 2 )
				$( c ).addClass( 'g_pp_bcf rounded' );
			else
				return false;

			$( b ).addClass( 'g_pp_bd' );

			$( c ).css( 'left', Math.floor( ( een.ww / 2 - ( w / 2 ) ) ) + 'px' );

			$( c ).css( 'width', w );
			$( b ).css( 'width', w - 10 );

			if( h > 0 )
			{
				$( c ).css( 'height', h );
				$( b ).css( 'height', h - 22 );
			}

			$( b ).html( t );
			$( c ).append( b );

			return c;
		}
	};

	return een.c_b( w, h, t );
}
