/*
* 
* INTERDI DIGITAL AGENCY
* www.interdi.com
* 2011
*
*/

TIP = {
	
	tipTrigger 	:	null,
	tipContent 	: 	null,
	tipcloser	: 	null,
	isOpen		:	null,	
	
	init : function () {
		
		// SET OBJECTS 
		TIP.tipTrigger = tipTrigger =  $('.tipTrigger')
		TIP.tipcloser = tipcloser =  $('.tipCloser')
		
		
		TIP.isOpen = isOpen = false;
		
		tipTrigger.bind('click' , TIP.showToolTip );
		tipcloser.bind('click' , TIP.hideToolTip );
		
		
	},
	showToolTip : function (e) {
		
		
		
		var obj = $(this);
		var objW = obj.width();
		var objH = obj.height();
		
		if (isOpen == false) {

			tipContent = obj.find('.tipitip');

			if(tipContent.hasClass('topR') == true) { 
				
				tipContent.css({'left': -(objW + 160) + 'px' , 'top' : (objH + 58) + 'px' }).fadeIn(500);
			
			} else if(tipContent.hasClass('left') == true) {
			
				tipContent.css({'left': +(objW + 40) + 'px' , 'top' : '0px' }).fadeIn(500);
				
			} else if(tipContent.hasClass('bottomR') == true) {
			
				tipContent.css({'left': -(objW + 150) + 'px' , 'top' : -355 + 'px' }).fadeIn(500);
				
			} else if(tipContent.hasClass('top') == true) {
			
				tipContent.css({'left': -(objW - 200) + 'px' , 'top' : -230 + 'px' }).fadeIn(500);
				
			}
			
			isOpen = true;
			
		}
		
		
		
		
		
	
	},
	hideToolTip : function () {
		
		var obj = $(this);
		obj.parent('.tipitip').fadeOut(300);
		isOpen =  false;
		return false;
		
		
	}
	
}


$(function () {
	
	TIP.init();
	
	
	$('#vidUploadForm').submit(function() {
		
		
		
		if(!$('.req-check2').is(':checked')){
		  	alert("Devam edebilmek için katılım şartnamesini kabul etmelisiniz");
			return false;
					
		}
		
		
		
	}); 
	
	
	$('#videoUpSubmit' ).formValidator({
        scope   : '#vidUploadForm', 
        errorDiv  : '#contacFormError'
	});	
	
	
	
	
	
	
	
});








