// JavaScript Document
function addToFavorites() {
	if (window.sidebar) {
		window.sidebar.addPanel(pageName, urlAddress, "");
	} else if (window.opera && window.print){
		var elem = document.createElement('a');
		elem.setAttribute('href',urlAddress);
		elem.setAttribute('title',pageName);
		elem.setAttribute('rel','sidebar');
		elem.click();
	} else if (document.all) {
		window.external.addfavorite(urlAddress, pageName);
	} else {
		alert("Sorry! Your browser doesn't support this function.");
	}
}

var popup_win;
function OpenWindow(url,iWidth,iHeight) {
	var pw_left=(screen.Width-parseInt(iWidth))/2;
	var pw_top=(screen.Height-parseInt(iHeight))/2;
	
	if (!popup_win || popup_win.closed) {
		popup_win=window.open(url, 'popupwin', 'menus=0, scrollbars=auto, toolbars=0, width='+iWidth+', height='+iHeight+', screenX='+pw_left+',screenY='+pw_top+',top='+pw_top+',left='+pw_left+';');
	} else {
		popup_win.close();
		popup_win=window.open(url, 'popupwin', 'menus=0, scrollbars=auto, toolbars=0, width='+iWidth+', height='+iHeight+', screenX='+pw_left+',screenY='+pw_top+',top='+pw_top+',left='+pw_left+';');
	}
}

$(document).ready(function() {
	$("a.fbIframe").fancybox({
		'width' : 500,
		'height' : 415,
		'transitionIn' : 'fade',
		'transitionOut' : 'fade',
		'type' : 'iframe',
		'overlayOpacity' : 0.6,
		'overlayColor' : '#000',
		'hideOnOverlayClick' : false,
		'centerOnScroll' : true,
		'margin' : 20,
		'padding' : 6
	});
	
	$("a.fbIframe2").fancybox({
		'width' : 660,
		'height' : 500,
		'transitionIn' : 'fade',
		'transitionOut' : 'fade',
		'type' : 'iframe',
		'overlayOpacity' : 0.6,
		'overlayColor' : '#000',
		'hideOnOverlayClick' : false,
		'centerOnScroll' : true,
		'margin' : 20,
		'padding' : 6
	});
	
	$("a.fbIframe3").fancybox({
		'width' : 440,
		'height' : 500,
		'transitionIn' : 'fade',
		'transitionOut' : 'fade',
		'type' : 'iframe',
		'overlayOpacity' : 0.6,
		'overlayColor' : '#000',
		'hideOnOverlayClick' : false,
		'centerOnScroll' : true,
		'margin' : 20,
		'padding' : 6
	});
	
	$("a.fbIframe4").fancybox({
		'width' : 540,
		'height' : 370,
		'transitionIn' : 'fade',
		'transitionOut' : 'fade',
		'type' : 'iframe',
		'overlayOpacity' : 0.6,
		'overlayColor' : '#000',
		'hideOnOverlayClick' : false,
		'centerOnScroll' : true,
		'margin' : 20,
		'padding' : 6
	});
	
	$("#youtubeVideo").click(function() {
		$.fancybox({
			'padding' : 0,
			'autoScale' : false,
			'transitionIn' : 'fade',
			'transitionOut' : 'fade',
			'title'	: this.title,
			'width'	: 640,
			'height' : 505,
			'overlayOpacity' : 0.6,
			'overlayColor' : '#000',
			'hideOnOverlayClick' : false,
			'centerOnScroll' : true,
			'href' : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type' : 'swf',
			'swf' : {
				'wmode' : 'transparent',
				'allowfullscreen' : 'true'
				
			}
		});
	
		return false;
	});
});