// JQuery-Custom Document
$(document).ready(function(){
   	// Img Hover
   	$(".imgHover").hover( function() {
    	var hoverImg = HoverImgOf($(this).attr("src"));
    	$(this).attr("src", hoverImg);
    	}, function() {
    	var normalImg = NormalImgOf($(this).attr("src"));
    	$(this).attr("src", normalImg);
    	}
  	);
   	
   	
   	
	// Qtip Customize
	$("#logobox a[title]").qtip({ 
	   	position: { 
	      	corner: { 
	         	target: 'bottomRight'
	      	}, 
	      	adjust: {
	   			x: -250,
	   			y: -20,
	   			resize: true
	   		}
	   	}, 
	   	style: { 
	      	width: 320,
	      	padding: 2,
	      	background: '#FDEB00',
	      	color: 'black',
	      	textAlign: 'center',
	      	border: {
	         	width: 3,
	         	radius: 7,
	         	color: '#000000'
	      	},
	      	tip: 'topLeft',
	      	name: 'dark'
	   	},
	   	show: { 
	   		delay: 200,
	   		effect: { 
	   			type: 'slide',
	   			length: 420 
	   		} 
	   	},
		hide: { 
	   		effect: { 
	   			type: 'slide',
	   			length: 350 
	   		} 
	   	}
	});
   	$("#home a[title]").qtip({ 
	   	position: { 
	      	corner: { 
	         	target: 'center'
	      	}, 
	      	adjust: {
	   			x: -45,
	   			y: 1,
	   			resize: true
	   		}
	   	}, 
	   	style: { 
	      	width: 110,
	      	padding: 2,
	      	background: '#FDEB00',
	      	color: 'black',
	      	textAlign: 'center',
	      	border: {
	         	width: 3,
	         	radius: 7,
	         	color: '#000000'
	      	},
	      	tip: 'topMiddle',
	      	name: 'dark'
	   	},
	   	show: { 
	   		delay: 200,
	   		effect: { 
	   			type: 'slide',
	   			length: 420 
	   		} 
	   	},
		hide: { 
	   		effect: { 
	   			type: 'slide',
	   			length: 350 
	   		} 
	   	}
	});
	$("#eventscalendarbtn a[title]").qtip({ 
	   	content: '<img id="calender-small" src="images/calender-small.png" />',
	   	position: { 
	      	corner: { 
	         	target: 'rightMiddle'
	      	}, 
	      	adjust: {
	   			x: -8,
	   			y: -280,
	   			resize: true
	   		}
	   	},
	   	style: { 
	      	width: 250,
	      	padding: 2,
	      	background: '#FDEB00',
	      	color: 'black',
	      	textAlign: 'center',
	      	border: {
	         	width: 10,
	         	radius: 12,
	         	color: '#2784DB'
	      	}
	   	},
	   	show: { 
	   		delay: 200,
	   		effect: { 
	   			type: 'grow',
	   			length: 320 
	   		} 
	   	},
		hide: { 
	   		effect: { 
	   			type: 'grow',
	   			length: 350 
	   		} 
	   	}
	});
	$("#facebook a[title]").qtip({ 
	   	position: { 
	      	corner: { 
	         	target: 'topMiddle'
	      	}, 
	      	adjust: {
	   			x: -35,
	   			y: -95,
	   			resize: true
	   		}
	   	}, 
	   	style: { 
	      	width: 90,
	      	padding: 2,
	      	background: '#42629E',
	      	color: '#FFFFFF',
	      	textAlign: 'center',
	      	border: {
	         	width: 3,
	         	radius: 7,
	         	color: '#3D527B'
	      	},
	      	tip: 'bottomMiddle',
	      	name: 'dark'
	   	},
	   	show: { 
	   		delay: 200,
	   		effect: { 
	   			type: 'fade',
	   			length: 420 
	   		} 
	   	},
		hide: { 
	   		effect: { 
	   			type: 'fade',
	   			length: 350 
	   		} 
	   	}
	});
	$("#contactus a[title]").qtip({ 
	   	position: { 
	      	corner: { 
	         	target: 'rightTop'
	      	}, 
	      	adjust: {
	   			x: -8,
	   			y: -65,
	   			resize: true
	   		}
	   	}, 
	   	style: { 
	      	width: 60,
	      	padding: 2,
	      	background: '#00AEEF',
	      	color: '#FFFFFF',
	      	textAlign: 'center',
	      	border: {
	         	width: 3,
	         	radius: 7,
	         	color: '#FFFFFF'
	      	},
	      	tip: 'leftBottom',
	      	name: 'dark'
	   	},
	   	show: { 
	   		delay: 200,
	   		effect: { 
	   			type: 'fade',
	   			length: 420 
	   		} 
	   	},
		hide: { 
	   		effect: { 
	   			type: 'fade',
	   			length: 350 
	   		} 
	   	}
	});
	$("#ilike a[title]").qtip({ 
	   	position: { 
	      	corner: { 
	         	target: 'rightBottom'
	      	}, 
	      	adjust: {
	   			x: -15,
	   			y: -75,
	   			resize: true
	   		}
	   	}, 
	   	style: { 
	      	width: 260,
	      	padding: 8,
	      	background: '#EC008C',
	      	color: '#FFFFFF',
	      	textAlign: 'center',
	      	border: {
	         	width: 3,
	         	radius: 7,
	         	color: '#0072BC'
	      	},
	      	tip: 'leftTop',
	      	name: 'dark'
	   	},
	   	show: { 
	   		delay: 200,
	   		effect: { 
	   			type: 'fade',
	   			length: 420 
	   		} 
	   	},
		hide: { 
	   		effect: { 
	   			type: 'fade',
	   			length: 350 
	   		} 
	   	}
	});
	
	
	// Fancybox
	$("a#zoomimage").fancybox({
		'titleShow'		: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic'
	});
	$("a#theteamframe").fancybox({
		'titleShow'		: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic'
	});
	$("#ilikeframe").fancybox({
		'width'				: '70%',
		'height'			: '88%',
		'autoScale'			: true,
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'type'				: 'iframe'
	});
	$("#contactusframe").fancybox({
		'width'				: '88%',
		'height'			: '88%',
		'autoScale'			: true,
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'type'				: 'iframe'
	});
	$("#signupframe").fancybox({
		'width'				: '70%',
		'height'			: '88%',
		'autoScale'			: true,
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'type'				: 'iframe'
	});
	$("#photoarchiveframe").fancybox({
		'width'				: '88%',
		'height'			: '88%',
		'autoScale'			: true,
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'type'				: 'iframe'
	});
	
	
	
	$("#teaservideoclick").click(function() {
		$.fancybox({
				'padding'		: 0,
				'autoScale'		: false,
				'transitionIn'	: 'none',
				'transitionOut'	: 'none',
				'title'			: this.title,
				'width'			: 680,
				'height'		: 495,
				'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
				'type'			: 'swf',
				'swf'			: {
					'wmode'		: 'transparent',
					'allowfullscreen'	: 'true'
				}
			});
	
		return false;
	});
});


function HoverImgOf(filename)
{
   var re = new RegExp("(.+)\\.(gif|png|jpg)", "g");
   return filename.replace(re, "$1-hover.$2");
}
function NormalImgOf(filename)
{
   var re = new RegExp("(.+)-hover\\.(gif|png|jpg)", "g");
   return filename.replace(re, "$1.$2");
}


