var iHeight=160,iWidth=320,minWidth=250,minHeight=170,maxWidth=960,maxHeight=720,cHeight,cWidth;
var typeStr,pageUrl,pageTitleStr,modelNameStr,closeTextStr,pageTitleEl,modelNameEl,overlay,wrapper,title,content,tabClass;
var pageHeight,pageWidth,windowHeight,windowWidth,scrollTop,scrollLeft;
var markup='<iframe class="model-popup-overlay" src="" frameborder="0"></iframe><div class="model-popup-overlay"></div><div class="model-popup-wrapper"><div class="model-popup-content"><div class="model-popup-title-block"><div class="model-popup-title"><h2></h2><h3></h3></div><div class="model-popup-close"><a href="javascript:;"></a></div></div><div class="model-popup-content-inner"></div></div></div>';
var customClass;
function model_popup(H,A,B,I,E,F,D,C,G,J){if(J!=null||J!=undefined){stopEvent(J)
}jQuery("body").css("height","auto");
pageHeight=jQuery("body").height();
pageWidth=jQuery("body").width();
windowHeight=jQuery(window).height();
windowWidth=jQuery(window).width();
scrollTop=jQuery(window).scrollTop();
scrollLeft=jQuery(window).scrollLeft();
pageUrl=A;
pageTitleStr=E;
modelNameStr=F;
closeTextStr=D;
typeStr=H;
tabClass=C;
if(typeStr!="slider"){cHeight=parseInt(I);
cWidth=parseInt(B);
if(cWidth>maxWidth){cWidth=maxWidth
}if(cHeight>maxHeight){cHeight=maxHeight
}if(cWidth<minWidth||isNaN(cWidth)){cWidth=minWidth
}if(cHeight<minHeight||isNaN(cHeight)){cHeight=minHeight
}}if(typeStr=="slider"){cWidth=maxWidth
}customClass=G;
initial()
}function initial(){jQuery("body").append(markup);
overlay=jQuery(".model-popup-overlay").addClass(customClass);
wrapper=jQuery(".model-popup-wrapper").addClass(customClass);
content=jQuery(".model-popup-content-inner");
title=jQuery(".model-popup-title-block");
pageTitleEl=jQuery(".model-popup-title > h2");
modelNameEl=jQuery(".model-popup-title > h3");
pageTitleEl.html(pageTitleStr);
modelNameEl.html(modelNameStr);
overlay.css({width:pageWidth,height:pageHeight}).click(function(){closePopup()
});
jQuery(".model-popup-close > a").html(closeTextStr).click(function(){closePopup()
});
wrapper.css({height:iHeight,width:iWidth,visibility:"visible",top:((windowHeight-iHeight)/2)+scrollTop,marginLeft:-(iWidth/2)});
if(typeStr=="slider"){content.load(pageUrl,function(){jQuery("ul.media-bar-tab-navigation a."+tabClass).click()
})
}if(typeStr=="page"){content.hide();
content.load(pageUrl,function(){wrapper.animate({height:cHeight+staticElementDimension(),top:((windowHeight-(cHeight+staticElementDimension()))/2)+scrollTop},function(){jQuery(this).animate({width:cWidth,marginLeft:-(cWidth/2)},function(){content.css({height:cHeight,width:cWidth-18,overflow:"auto"}).fadeIn(500)
})
})
})
}if(typeStr=="flexiblePage"){title.remove();
content.hide();
content.load(pageUrl,function(A){cHeight=content.outerHeight();
cWidth=content.outerWidth();
wrapper.animate({height:cHeight,top:((windowHeight-(cHeight))/2)+scrollTop},function(){jQuery(this).animate({width:cWidth,marginLeft:-(cWidth/2)},function(){content.fadeIn(500)
})
})
})
}}function staticElementDimension(){var C=["div.model-popup-title-block"];
var A=0;
for(var B=0;
B<C.length;
B++){A+=jQuery(C[B]).height()
}return(typeStr!="flexiblePage")?A+14:A
}function calculatePopupHeightDimension(){return(content.height()+staticElementDimension())
}function calculateVerticalPopupPosition(A){wrapper.animate({height:calculatePopupHeightDimension(),top:((windowHeight-calculatePopupHeightDimension())/2)+scrollTop},function(){A
})
}function calculateHorizontalPopupPosition(A){wrapper.animate({width:maxWidth,marginLeft:-(cWidth/2)},function(){A
})
}function closePopup(){wrapper.fadeOut("normal",function(){jQuery(this).remove();
overlay.remove();
if(jQuery("img#tempPic").length>0){jQuery("img#tempPic").remove()
}jQuery("body").css("height","100%")
})
}function stopEvent(A){if(!A){var A=window.event
}A.cancelBubble=true;
A.returnValue=false;
if(A.stopPropagation){A.stopPropagation();
A.preventDefault()
}return false
};