$(document).ready(function(){

	var pop_page_num = 0;
	
	$('a.popup').click(function(e) {
	
		pop_page_num++;
	
		link = $(this).attr('href');
		//alert(link);
		
		name = 'popup_' + pop_page_num;
		intwidth = 500;
		intheight = 500;
		
		left = (screen.width - intwidth) / 2;
		top = (screen.height - intheight) / 2;
		properties = 'toolbar=0, scrollbars=1, location=0, status=0, menubar=0, titlebar=0, width=' + intwidth + ', height=' + intheight + ', left=' + left + ', top=' + top + ', resizable=1';
    	window.open(link, name, properties);
		
		e.preventDefault();	
	
	});
			
	Shadowbox.init({
		modal: true,
		troubleElements: ['select','canvas'],
		overlayOpacity: 0.7
	});
	
	
	$('a.video').click(function() {
		openShadowbox($(this).attr('href'));
		return false;
	});
	
	
	$('a.shadowbox').click(function() {
		Shadowbox.open({
			content:    $(this).attr('href'),
			player:     'iframe',
			height:     500,
			width:      500
		})
		return false;
	});
	
	
});

function openShadowbox(content, page)
{   
   if(page)
   {
		Shadowbox.open({
			content:    content,
			player:     'iframe',
			height:     350,
			width:      250
		})	
   } else
   { 		   
	   Shadowbox.open({
			content:    content,
			player:     'iframe',
			height:     450,
			width:      800
		});
	}
}

function emailAFriend() {

	/*
	link = 'send.html';

	name = 'popup_friend';
	intwidth = 500;
	intheight = 500;
	
	left = (screen.width - intwidth) / 2;
	top = (screen.height - intheight) / 2;
	properties = 'toolbar=0, scrollbars=1, location=0, status=0, menubar=0, titlebar=0, width=' + intwidth + ', height=' + intheight + ', left=' + left + ', top=' + top + ', resizable=1';
	window.open(link, name, properties);
	*/
	
	Shadowbox.open({
		content:    'send.html',
		player:     'iframe',
		height:     380,
		width:      350
	});

}

//emailfriend

function emailAFriend2() {

	/*
	link = 'send.html';

	name = 'popup_friend';
	intwidth = 500;
	intheight = 500;
	
	left = (screen.width - intwidth) / 2;
	top = (screen.height - intheight) / 2;
	properties = 'toolbar=0, scrollbars=1, location=0, status=0, menubar=0, titlebar=0, width=' + intwidth + ', height=' + intheight + ', left=' + left + ', top=' + top + ', resizable=1';
	window.open(link, name, properties);
	*/
	
	Shadowbox.open({
		content:    'send.html?m=emailfriend',
		player:     "iframe",
		height:     380,
		width:      350
	});

}
