// JavaScript Document
	var imagePreloader = new Image
	var aktifgelennesne;
	var callbackfunction;
	var overlayOpacity=0.5;
	var iframeyolu='';
	var icerikoncesianimasyondurumu=0;
	var icerikyuklendimi=0;
	var iframemi="";
	var aktifgelennesneOpts = {
						'left':		'0px',
						'top':		'0px',
						'width':	'0px',
						'height':	'0px'
					};
	var ihsanmodal_html='						<div id="ihsan_overlay"></div>';
		ihsanmodal_html+='						<div id="ihsan_outer">';
		ihsanmodal_html+='							<div id="ihsan_inner">';
		ihsanmodal_html+='							<table id="ihsanmodaltable0" border="0" cellpadding="0" cellspacing="0" align="center">';
		ihsanmodal_html+='							  <tr height="23px" style="height:23px">';
		ihsanmodal_html+='								<td id="tdsolust" height="23px"><div style="position:relative;width:100%;height:100%"><img class="ovalkoseler" id="ovalkosesolust" src="_js/ihsanmodal/images/ovalkosesolust.png" title="" />&nbsp;</div></td>';
		ihsanmodal_html+='								<td id="tdustorta" height="23px">&nbsp;</td>';
		ihsanmodal_html+='								<td id="tdsagust" height="23px"><div style="position:relative;width:100%;height:100%"><img class="ovalkoseler" id="ovalkosesagust" src="_js/ihsanmodal/images/ovalkosesagust.png" title="" />&nbsp;</div></td>';
		ihsanmodal_html+='							  </tr>';
		ihsanmodal_html+='							  <tr>';
		ihsanmodal_html+='								<td id="tdsolorta"></td>';
		ihsanmodal_html+='								<td id="tdortaorta"></td>';
		ihsanmodal_html+='								<td id="tdsagorta"></td>';
		ihsanmodal_html+='							  </tr>';
		ihsanmodal_html+='							  <tr height="23px">';
		ihsanmodal_html+='								<td id="tdsolalt"><div style="position:relative;width:100%;height:100%"><img class="ovalkoseler" id="ovalkosesolalt" src="_js/ihsanmodal/images/ovalkosesolalt.png" title="" />&nbsp;</div></td>';
		ihsanmodal_html+='								<td id="tdaltorta">&nbsp;</td>';
		ihsanmodal_html+='								<td id="tdsagalt"><div style="position:relative;width:100%;height:100%"><img class="ovalkoseler" id="ovalkosesagalt" src="_js/ihsanmodal/images/ovalkosesagalt.png" title="" />&nbsp;</div></td>';
		ihsanmodal_html+='							  </tr>';
		ihsanmodal_html+='							</table>';
		ihsanmodal_html+='							</div>';
		ihsanmodal_html+='						</div>';
	function modalcagiriframe(gelennesne,width,height,iframemigelen,yol,backroundrengi,overlayOpacityGelen,scrollinga,gelencallbackfunction){
					//jQuery("#ihsanmodal_closebutton").css({'display':'none'});
					jQuery("#ihsan_outer").remove();
					jQuery("#ihsan_overlay").remove();
					jQuery("body").prepend(ihsanmodal_html);
					/*jQuery("#ihsan_outer").css({'display':'block'});
					jQuery("#ihsan_outer").css({'display':'block','width':'300px','height':'300px','z-index':'95'});
					jQuery("#ihsan_overlay").css({'display':'block','left':'0px','top':'0px'});*/
					icerikoncesianimasyondurumu=1;
					icerikyuklendimi=0;
					overlayOpacity=overlayOpacityGelen;
					callbackfunction=gelencallbackfunction;
					iframemi=iframemigelen;
					iframeyolu=yol;
					jQuery("#tdortaorta").css({'background-color':backroundrengi,'opacity':'0.5'})
					
					var w = getViewport();
					var itemLeft	= (width + 36)	> w[0] ? w[2] : (w[2] + Math.round((w[0] - width - 36) / 2));
					var itemTop		= (height + 50)	> w[1] ? w[3] : (w[3] + Math.round((w[1] - height - 50) / 2));
					
					var itemOpts = {
						'left':		itemLeft-w[2],
						'top':		itemTop/*,
						'width':	width + 'px',
						'height':	height + 'px'*/
					};
					jQuery("#ihsan_overlay").css({
						'left':		itemLeft-w[2],
						'top':		itemTop,
						'width':	width + 'px',
						'height':	height + 'px'
					});

					jQuery("#ihsan_inner").append('<div id="ihsanmodal_closebutton"></div>')
					if (iframemi=="iframe"){
					var iframe='<iframe id="ihsan_iframe" scrolling="' + scrollinga + '" onload="IframeYuklendi()"  name="ihsan_iframe' + Math.round(Math.random()*1000) + '" frameborder="0" hspace="0" src="' + yol + '" height="' + (height-46)+ '" width="' + (width-46) + '" style="display:none"></iframe>';
					jQuery("#tdortaorta").append(iframe)
					}else {
							imagePreloader = new Image; 
							imagePreloader.src = yol;
			
							if (imagePreloader.complete) {
								proceed_image(yol);
							} else {
			
								jQuery(imagePreloader).unbind().bind('load', function() {
									proceed_image(yol);
								});
							}

					
					}
					
					aktifgelennesne = gelennesne
					var orig_pos	= getPosition(jQuery(aktifgelennesne));
					//alert(jQuery(orig_item).width());
					var ilknesnewidth=jQuery(aktifgelennesne).width();
					if (ilknesnewidth<46){ilknesnewidth=46;}
					var ilknesneheight=jQuery(aktifgelennesne).height();					
					if (ilknesneheight<69){ilknesneheight=69;}
					
					aktifgelennesneOpts = {
						'left':		(orig_pos.left - 18-w[2]) + 'px',
						'top':		(orig_pos.top  - 18-w[3]) + 'px',
						'width':	ilknesnewidth,
						'height':	ilknesneheight
					};
					jQuery("#ihsan_outer").css({
						'left':		(orig_pos.left - 18 -w[2]- (width-46)/2) + 'px',
						'top':		(orig_pos.top  - 18 ) + 'px',
						'width':	width,
						'height':	height
					});
					jQuery("#ihsan_outer").css({'display':'block'});
					jQuery("#tdortaorta").css({'height':'1px','width':'1px'});
					
					jQuery("#tdortaorta").animate({'height': (height-46),'width': (width-46)},1000,'easeInExpo')
					jQuery("#ihsan_outer").animate(itemOpts, 1200, 'easeInOutQuart', function() {
						animasyonfinish();
					});

	
	}
	
	function animasyonfinish(){
		jQuery("#ihsan_inner").append('<div id="ihsanmodal_closebutton"></div>')
		jQuery("#ihsanmodal_closebutton").css({'display':'inline-block','z-index':'152'});
		jQuery("#ihsan_overlay, #ihsanmodal_closebutton").bind("click", function(){modalgizle()});
		//jQuery(window).bind("resize scroll",function(){kutuyusabitkil()});
		jQuery("#ihsan_overlay").css({'opacity':overlayOpacity});
		jQuery("#ihsan_overlay").animate({
								'left':		0,
								'top':		0,
								'width':	'100%',
								'height':	jQuery(document).height()+200+'px'
								},200,'linear',function(){
										icerikoncesianimasyondurumu=2;
										if (icerikyuklendimi==1){
											if (iframemi=="iframe"){
											jQuery("#tdortaorta").css({'opacity':'1'});
											jQuery("#ihsan_iframe").css({'display':'block'});
											}else {
											proceed_image();
											}
										}									
									});
		//jQuery("#ihsan_iframe").css({'display':'inline'});
	}

	function modalgizle(){
					icerikoncesianimasyondurumu=0;
					icerikyuklendimi=0;
					jQuery("#tdortaorta").css({'opacity':'0.5'})
					jQuery("#ihsan_iframe").css({'display':'none'});
					jQuery("#ihsan_overlay, #ihsanmodal_closebutton").unbind();
					//jQuery(window).unbind("resize scroll");
					jQuery("#ihsanmodal_closebutton").css({'display':'none'});
					jQuery("#ihsanmodal_closebutton").remove();
					jQuery("#ihsan_iframe").remove();;
					jQuery("#ihsan_overlay").css({'display':'none'});

					var w = getViewport();
					var orig_pos	= getPosition(jQuery(aktifgelennesne));
					//alert(jQuery(orig_item).width());
					var ilknesnewidth=jQuery(aktifgelennesne).width();
					if (ilknesnewidth<46){ilknesnewidth=46;}
					var ilknesneheight=jQuery(aktifgelennesne).height();					
					if (ilknesneheight<69){ilknesneheight=69;}
					
					aktifgelennesneOpts = {
						'left':		(orig_pos.left - 18-w[2]) + 'px',
						'top':		(orig_pos.top  - 18) + 'px',
						'width':	ilknesnewidth,
						'height':	ilknesneheight
					};
					
					jQuery("#ihsan_outer").stop().animate(aktifgelennesneOpts, 1000, 'easeInBack', function() {
						jQuery("#ihsan_outer").css({'display':'none'});
						jQuery("#ihsan_outer").remove();
						jQuery("#ihsan_overlay").remove();
						if (callbackfunction!=undefined){
						callbackfunction();	
						}
					});																 
					jQuery("#tdortaorta").stop().animate({'height':'0px','width': '0px'},1000,'easeInOutQuart');

	
	}
	
	IframeYuklendi= function() {
		icerikyuklendimi=1;
		if (icerikoncesianimasyondurumu==2){ 
			jQuery("#tdortaorta").css({'opacity':'1'});
			jQuery("#ihsan_iframe").css({'display':'block'});
			jQuery("#tdortaorta").css({'opacity':'1'});
		}
		
	}
	
	getPosition = function(el) {
		var pos = el.offset();

		pos.top	+= getNumeric(el, 'paddingTop');
		pos.top	+= getNumeric(el, 'borderTopWidth');

		pos.left += getNumeric(el, 'paddingLeft');
		pos.left += getNumeric(el, 'borderLeftWidth');

		return pos;
	};
	
	getViewport = function() {
		return [jQuery(window).width(), jQuery(window).height(), jQuery(document).scrollLeft(), jQuery(document).scrollTop() ];
	};

	getNumeric = function(el, prop) {
		return parseInt(jQuery.curCSS(el.jquery?el[0]:el,prop,true))||0;
	};
	
	proceed_image=function(yol) {
		var imageScale=true;
		if (imageScale) {
			var w = getViewport();

			var r = Math.min(Math.min(w[0] - 36, imagePreloader.width) / imagePreloader.width, Math.min(w[1] - 60, imagePreloader.height) / imagePreloader.height);

			var width = Math.round(r * imagePreloader.width);
			var height = Math.round(r * imagePreloader.height);

		} else {
			var width = imagePreloader.width;
			var height = imagePreloader.height;
		}
		//return [width, height];
		icerikyuklendimi=1;
		if (icerikoncesianimasyondurumu==2){
			CerceveYenidenBoyutlandir(width,height)
		}
	};	
	
	function CerceveYenidenBoyutlandir(width,height){
					var w = getViewport();
					var rb=[width,height];
					var itemLeft	= ((width+46) + 36)	> w[0] ? w[2] : (w[2] + Math.round((w[0] - (width+46) - 36) / 2));
					var itemTop		= ((height+46) + 50) > w[1] ? w[3] : (w[3] + Math.round((w[1] - (height+46) - 50) / 2));
					jQuery("#ihsanmodal_closebutton").css({'display':'none'});
					if (jQuery("#ihsan_outer").width()<=width && jQuery("#ihsan_outer").height()<=height ){
						var itemOpts = {
							'left':		itemLeft-w[2],
							'top':		itemTop,
							'width':	width +46+ 'px',
							'height':	height +46+ 'px'
						};					
						jQuery("#ihsan_outer").css({
							'width':	width+46,
							'height':	height+46,
							'left':		itemLeft-w[2]
						});
					}else if(jQuery("#ihsan_outer").width()<width && jQuery("#ihsan_outer").height()>height ){
						var itemOpts = {
							'left':		itemLeft-w[2],
							'top':		itemTop,
							'width':	width +46+ 'px',
							'height':	height +46+ 'px'
						};					
						jQuery("#ihsan_outer").css({
							'width':	width+46,
							'left':		itemLeft-w[2]
						});
					}else if(jQuery("#ihsan_outer").width()>width && jQuery("#ihsan_outer").height()<height ){
						var itemOpts = {
							'left':		itemLeft-w[2],
							'top':		itemTop,
							'width':	width +46+ 'px',
							'height':	height +46+ 'px'
						};					
						jQuery("#ihsan_outer").css({
							'height':	height+46							
						});
					}else if(jQuery("#ihsan_outer").width()>width && jQuery("#ihsan_outer").height()>height ){
						var itemOpts = {
							'left':		itemLeft-w[2],
							'top':		itemTop,
							'width':	width +46+ 'px',
							'height':	height +46+ 'px'
						};
						
					}
					
					jQuery("#tdortaorta").animate({'height': (height),'width': (width)},500,'easeInBack');
					
					jQuery("#ihsan_outer").animate(itemOpts, 600, 'easeInBack', function() {
							jQuery("#ihsanmodal_closebutton").css({'display':'block'});
							//alert(rb[0] + " " + rb[1]);
							var iframe='<img id="ihsan_iframe" src="' + imagePreloader.src +'" title="" tag="" style="height:' + rb[1] +'px;width:' + rb[0] +'px;display:none">';						
							jQuery("#tdortaorta").append(iframe);
							jQuery("#ihsan_iframe").css({'display':'block'});
							jQuery("#tdortaorta").css({'opacity':'1'});
					});

	}
	
	kutuyusabitkil = function() {
		var pos = getViewport();

		$("#ihsan_outer").css('left', (($("#ihsan_outer").width()	+ 36) > pos[0] ? pos[2] : pos[2] + Math.round((pos[0] - $("#ihsan_outer").width()	- 36)	/ 2)));
		$("#ihsan_outer").css('top',  (($("#ihsan_outer").height()	+ 50) > pos[1] ? pos[3] : pos[3] + Math.round((pos[1] - $("#ihsan_outer").height()	- 50)	/ 2)));
	};	