function doIt () {}

// Define corners and opposites arrays
var corners = [
   'bottomLeft', 'bottomRight', 'bottomMiddle',
      'topRight', 'topLeft', 'topMiddle',
         'leftMiddle', 'leftTop', 'leftBottom',
	    'rightMiddle', 'rightBottom', 'rightTop'
	    ];
var opposites = [
	       'topRight', 'topLeft', 'topMiddle',
	          'bottomLeft', 'bottomRight', 'bottomMiddle',
		     'rightMiddle', 'rightBottom', 'rightTop',
		        'leftMiddle', 'leftTop', 'leftBottom'
];
	

$( document ).ready ( function () {
		
		
		return;	
		var labels = $('a') 
		var i = 0;
		for ( i = 0; i< labels.length ; ++i ){
			initFormToolTip.call ( labels [ i ] ); 

		};
		
		
		
} );

function getOpposite ( val ){
		for ( i = 0 ; i < corners.length && corners [ i ] != val ; ++i );
		if ( i > corners.length )
				return null;
		var r = opposites [ i ];
		//alert ( val + " / " + r );
		return r;
}

function isChildOf ( tagName , el ){
		var elements = $( el ).parents ( tagName );
		return  ( elements.length > 0);
}

function initFormToolTip ( ) {
	var toolTip = 'topLeft';
	var target = 'topRight';
        
	switch ( $(this).attr ('id') ){
		case "prev":
				toolTip = 'leftMiddle';
				target = getOpposite ( toolTip );
		break;
		
		case "next":
				toolTip = 'rightMiddle';
				target = getOpposite ( toolTip );
		break;
		
		case "up":
				toolTip = 'bottomMiddle';
				target = getOpposite ( toolTip );
		break;
		
	}
		
        if ( isChildOf ( 'tfoot' , this) ) {
		toolTip = 'bottomMiddle';
		target = getOpposite ( toolTip );
		
	}
	
	var className = $(this).attr ( 'class' );
	switch ( className ){
		case "noToolTip":
						return;
				break;
		case "dropDownToolTip":
						toolTip = 'leftMiddle';
						target = getOpposite ( toolTip );
				break;
		return;
	}
	if($(this).data("qtip")) $(this).qtip("destroy");
	$(this).qtip({
		content: $(this).attr('alt'), // Set the tooltip content to the current corner
		position: {
			corner: {
			
			tooltip: toolTip, // Use the corner...
			target: target // ...and opposite corner

			}
		},
		show:  {
			ready: false, // Show the tooltip when ready
			when: {
				target: false,
				event: 'mouseover'
			}
		},
		style: {
			border: {
				width: 0,
				radius: 7,
				color: '#444444'
			},
			padding: 5, 
			background: '#444444',
			color: '#ffffff',
			zIndex: 1000,
			'font-weight': 'bold',
			margin: 5,
			textAlign: 'center',
			tip: true, // Give it a speech bubble tip with automatic corner detection
			name: 'light' // Style it according to the preset 'cream' style
		}
	});
	

}






function firstRunSplash ( ) {
		var toolTip = 'bottomMiddle';
		var target = getOpposite ( toolTip );
		
		
		
	}
	
	function mySetCookie ( k , v ){
		//$(document).attr ( 'cookie' , k + "=" + v );
		return setCookie ( k , v );
	}
	
	function myGetCookie ( k ){
		return getCookie ( k );
	}
	
	function firstRunCheck ( ){
		
		
		var cookieName = "wewew";
		var targetValue = "X";
		var cookieVal;
		
		if ( ( cookieVal = myGetCookie ( cookieName ) ) !=  targetValue   ) {
				firstRunSplash ( );
				mySetCookie ( cookieName , targetValue );		
		} else {
				
		}
		//alert ( cookieVal );
		//alert ( $(document).attr ( 'cookie' ));
		
	}
