var curImg;
$(document).ready(function(){
	
});

function show(img, tImg, type){
	if(curImg != null){
		$("#"+curImg).removeClass('opened');
	}
	curImg = "thmb" + tImg;
	if($(".bigPhoto").hasClass('open').toString() == "false"){
		$(".bigPhoto").animate({width: '600px'}, 500);
		$(".bigPhoto").addClass('open');
		$(".close").addClass('v')
	}
	$("#thmb" + tImg).addClass('opened');
	
	var htmlToInsert;
	if(type == 'i'){
		htmlToInsert = '<img src="'+img+'" />';
	} else if(type == 'v'){
		htmlToInsert = '<iframe src="'+img+'?byline=0&amp;portrait=0" width="600" height="338" frameborder="0"></iframe>';
	} else if(type == 'y'){
		htmlToInsert = '<object style="height: 370; width: 600px"><param name="movie" value="'+img+'?version=3"><param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always"><embed src="'+img+'?version=3" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="600" height="370"></object>';
	}
	$(".bigPhoto").html(htmlToInsert);
}

function closeImg(){
	$(".bigPhoto").animate({width: '0px'}, 500, function() {
	    $(".bigPhoto").html("");
	  });
	$(".bigPhoto").removeClass('open');
	$("#"+curImg).removeClass('opened');
	curImg = null;
	$(".close").removeClass('v');
	
}
