
var IE=document.all?true:false;embedHide=0;function deGlobalWin(params){pG=params;if($$("object")){var flashEls=$$("object");for(var i=0;i<flashEls.length;i++){flashEls[i].style.visibility="hidden";}}
if($$("iframe")){var frames=$$("iframe");for(var i=0;i<frames.length;i++){frames[i].style.visibility="hidden";}}
if(IE){removeEls('hide');}
var win="<div id='globalWin' style='display:none;' onclick='clearWin();' align='center'></div>";if(document.body.id){var bigID=document.body.id;}else{var bigID="bigID";document.body.id=bigID;}
$(bigID).insert(win);$('globalWin').appear({duration:.6});var newDim=document.body.scrollHeight
var newDim2=document.viewport.getHeight()
if(newDim<newDim2){newDim=newDim2;}
$('globalWin').style.height=newDim+"px";$('globalWin').style.width="100%";var conWin="<div id='conWin' align='center' style='display:none;'><div id='winLoader'>Loading...<br><a href='#' onclick='clearWin();' id='winCancel'>cancel</a></div><div id='conWinInner' style='top:40px;visibility:hidden;' align='center'></div></div>";$('globalWin').insert({before:conWin});$('conWinInner').style.visibility="hidden";if(params.loader==false){$('winLoader').hide();}
resizeWinLoader();$('conWin').appear({duration:.6});Event.observe(window,'scroll',function(){if($('globalWin')){resizeWin(1);}});Event.observe(window,"resize",function(){if($('globalWin')){resizeWin(1);}});if(params.div==undefined){new Ajax.Updater('conWinInner',params.path,{parameters:{},evalScripts:true,onComplete:function(){showme();}});}else{var winFill=$(params.div).innerHTML;$('conWinInner').update(winFill);setTimeout("showme();",750);}}
function showme(){var badTag=$$('#conWinInner title');var badTag2=$$('#conWinInner meta');for(var i=0;i<badTag.length;i++){Element.remove(badTag[i]);}
for(var i=0;i<badTag2.length;i++){Element.remove(badTag2[i]);}
if(pG.hasOwnProperty('width')){$('conWinInner').setStyle({width:pG.width});}else{var conWidth=$('conWinInner').firstDescendant().getWidth();if(conWidth!=0){$('conWinInner').style.width=conWidth+"px";}else{$('conWinInner').style.width="400px";}}
if(pG.hasOwnProperty('background')){$('conWinInner').setStyle({background:pG.background});}
if(pG.hasOwnProperty('border')){$('conWinInner').setStyle({border:pG.border});}
if(pG.hasOwnProperty('height')){$('conWinInner').setStyle({height:pG.height});}
if(pG.hasOwnProperty('overflow')){$('conWinInner').setStyle({overflow:pG.overflow});}
var closeBthClass="";if(pG.hasOwnProperty('title')){var titleWin="<h4 class='win' id='titleHandle' align='left'> &nbsp;"+pG.title+"</h4>";$('conWinInner').insert({top:titleWin});}else{var closeBthClass="grayCloseWin";}
if(pG.closebtn!=false){var closeWin="<a class='closeWin "+closeBthClass+"' onclick='clearWin();'>X CLOSE</a>";$('conWinInner').insert({top:closeWin});}
resizeWin();$('winLoader').fade({duration:.5,scope:'present',queue:'front'})
$('conWinInner').style.display="none";$('conWinInner').style.visibility="";$('conWinInner').appear({scope:'present',queue:'end',duration:.5});Element.remove($('winLoader'));if(pG.drag==true||pG.drag=='full'){if($('titleHandle')&&pG.drag!='full'){new Draggable('conWinInner',{scroll:window,handle:'titleHandle',onDrag:function(){Event.stopObserving(window,'scroll');Event.stopObserving(window,'resize');}});$('titleHandle').style.cursor="move";}else{new Draggable('conWinInner',{scroll:window,onDrag:function(){Event.stopObserving(window,'scroll');Event.stopObserving(window,'resize');}});}}}
function unRegisterResize(){Event.stopObserving(window,'scroll');Event.stopObserving(window,'resize');}
function removeEls(act){if(act=='hide'){$$('select').each(function(s,index){s.hide();});}else{$$('select').each(function(s,index){s.show();});}}
function resizeWin(observeCall){var element='conWinInner';if($(element)!=null){if(typeof window.innerHeight!='undefined'){yWithScroll=document.body.scrollHeight;var maxTop=Math.round(yWithScroll-$(element).getHeight());var newHeight=Math.round(document.viewport.getScrollOffsets().top+
((window.innerHeight-$(element).getHeight()))/2);if(newHeight<0){var newHeight=1;}else if(newHeight>maxTop){var newHeight=maxTop-1;}
if(window.innerHeight<$(element).getHeight()&&observeCall!=1){$(element).style.top=newHeight+'px';}else if(window.innerHeight>$(element).getHeight()){$(element).style.top=newHeight+'px';}}else{yWithScroll=document.body.scrollHeight;var maxTop=Math.round(yWithScroll-$(element).getHeight());var newHeight=Math.round(document.viewport.getScrollOffsets().top+
((document.viewport.getHeight()-$(element).getHeight()))/2)
if(newHeight<0){var newHeight=1;}else if(newHeight>maxTop){var newHeight=maxTop-1;}
if(document.viewport.getHeight()<$(element).getHeight()&&observeCall!=1){$(element).style.top=newHeight+'px';}else if(document.viewport.getHeight()>$(element).getHeight()){$(element).style.top=newHeight+'px';}}}}
function resizeWinLoader(observeCall){var element='winLoader';if($(element)!=null){if(typeof window.innerHeight!='undefined'){yWithScroll=document.body.scrollHeight;var maxTop=Math.round(yWithScroll-$(element).getHeight());var newHeight=Math.round(document.viewport.getScrollOffsets().top+
((window.innerHeight-$(element).getHeight()))/2);if(newHeight<0){var newHeight=1;}else if(newHeight>maxTop){var newHeight=maxTop-1;}
if(window.innerHeight<$(element).getHeight()&&observeCall!=1){$(element).style.top=newHeight+'px';}else if(window.innerHeight>$(element).getHeight()){$(element).style.top=newHeight+'px';}}else{yWithScroll=document.body.scrollHeight;var maxTop=Math.round(yWithScroll-$(element).getHeight());var newHeight=Math.round(document.viewport.getScrollOffsets().top+
((document.viewport.getHeight()-$(element).getHeight()))/2)
if(newHeight<0){var newHeight=1;}else if(newHeight>maxTop){var newHeight=maxTop-1;}
if(document.viewport.getHeight()<$(element).getHeight()&&observeCall!=1){$(element).style.top=newHeight+'px';}else if(document.viewport.getHeight()>$(element).getHeight()){$(element).style.top=newHeight+'px';}}}}
function clearWin(){Element.remove($('globalWin'));Element.remove($('conWin'));var flashEls=$$("object");for(var i=0;i<flashEls.length;i++){flashEls[i].style.visibility="visible";}
if($$("iframe")){var frames=$$("iframe");for(var i=0;i<frames.length;i++){frames[i].style.visibility="visible";}}
if(IE){removeEls('show');}
if(embedHide==1){embedHide=1;$('vidWindow').style.position="relative";$('vidWindow').style.left="0px";}}
