/*07/16/09*/
/*
Copyright © 2009 Eckx Media Group, LLC. All rights reserved.
Eckx Media Group respects the intellectual property of others, and we ask our users to do the same.
*/  
  
 var curtain = { index: -1, expandLink: false, expandView: false, hideSelects: new Array(),
 urls: new Array(), init: function(){ curtain.index = -1; var V25b46a50 = document.createElement('div');
V25b46a50.id = 'curtain_blinds'; document.body.appendChild(V25b46a50); curtain.initLinks($$('body').first());
Event.stopObserving(window, 'load', curtain.init); }, initLinks: function(element){ var V7a76872f = element.select('a[rel*="curtain"]');
for(var i=0; i<V7a76872f.length; i++){ V7a76872f[i].href ='javascript:curtain.ajax(\''+V7a76872f[i].href.replace(document.location.protocol+'//'+document.domain, '')+'\')';
}
 var V7a76872f = element.select('a[rel*="curtsame"]'); for(var i=0; i<V7a76872f.length; i++){
 V7a76872f[i].href ='javascript:curtain.ajax(\''+V7a76872f[i].href.replace(document.location.protocol+'//'+document.domain, '')+'\', true)';
} }, load: function(){ curtain.openBlinds(); var loadPop = document.createElement('div'); loadPop.id = 'curtain_load';
document.body.appendChild(loadPop); loadPop = $('curtain_load'); loadPop.addClassName('curtain_load'); 
 V79ad18f7 = getTopLeft(loadPop.getWidth(), loadPop.getHeight()); loadPop.style.top = V79ad18f7[0]+'%';
loadPop.style.left = V79ad18f7[1]+'%'; loadPop.style.zIndex = curtain.index + 1; loadPop.innerHTML = '<img src="'+window.CR+'/images/library/loading.gif" />';
}, content: function(html, sameLayer, width, height, noPadding){ if(sameLayer == true){ if(!$('curtain_popUp'+curtain.index)){
 alert('curtain error: samelayer is set, but theres no curtain layer yet'); } document.body.removeChild($('curtain_popUp'+curtain.index));
curtain.content(html, false, width, height, noPadding); return; } if($('curtain_load')){ document.body.removeChild($('curtain_load')); 
 } 
 var popUp = document.createElement('div'); var Ve6e48e35 = document.createElement('div'); 
 var V3c559b6d = document.createElement('div'); var bodyLayer = document.createElement('div'); popUp.id = 'curtain_popUp'+curtain.index;
Ve6e48e35.id = 'curtain_closeLayer'+curtain.index; V3c559b6d.id = 'curtain_contentLayer'+curtain.index;
bodyLayer.id = 'curtain_bodyLayer'+curtain.index; 
 popUp.appendChild(Ve6e48e35); popUp.appendChild(V3c559b6d);
V3c559b6d.appendChild(bodyLayer); document.body.appendChild(popUp); 
 popUp = $('curtain_popUp'+curtain.index);
Ve6e48e35 = $('curtain_closeLayer'+curtain.index); V3c559b6d = $('curtain_contentLayer'+curtain.index);
bodyLayer = $('curtain_bodyLayer'+curtain.index); popUp.style.visibility = 'hidden'; popUp.addClassName('curtain_popUp');
Ve6e48e35.addClassName('curtain_close'); bodyLayer.addClassName('curtain_body'); if (noPadding) { V3c559b6d.addClassName('no-padding'); 
 } 
 if (curtain.expandLink) { closeLayerHtml = '<a href="javascript:curtain.expand()" id="curtain_expand'+curtain.index+'" class="expand" title="Expand / Contract"></a>';
closeLayerHtml += '<a href="javascript:curtain.close()" class="close" title="Close"></a>'; } else {
 closeLayerHtml = '<a href="javascript:curtain.close()" class="close" title="Close"></a>'; } Ve6e48e35.innerHTML = closeLayerHtml;
 bodyLayer.innerHTML = html; V3c559b6d.addClassName('curtain_content'); if(curtain.expandView){ curtain.expand();
} else if(parseFloat(width) != width || parseFloat(height) != height){ curtain.autoSize(); } else{ 
 curtain.resizeContent(width, height); } popUp.style.zIndex = curtain.index + 1; popUp.style.visibility = 'visible';
}, autoSize: function(){ 
 var popUp = $('curtain_popUp'+curtain.index); var V3c559b6d = $('curtain_contentLayer'+curtain.index);
var Vcf7a960f = V3c559b6d.firstDescendant(); var Ve6e48e35 = $('curtain_closeLayer'+curtain.index);
width = Vcf7a960f.getWidth(); height = Vcf7a960f.getHeight(); maxW = document.viewport.getWidth();
maxH = document.viewport.getHeight(); if(height >= (maxH - 25)){ height = maxH - 50; } if(width >= (maxW - 25)){
 width = maxW - 25; } V3c559b6d.style.height = height+'px'; height += Ve6e48e35.getHeight(); width += 18; 
 var V79ad18f7 = getTopLeft(width, height); popUp.style.width = width+'px'; popUp.style.height = height+'px';
popUp.style.top = V79ad18f7[0]+'%'; popUp.style.left = V79ad18f7[1]+'%'; }, resizeContent: function(width, height){
 var popUp = $('curtain_popUp'+curtain.index); var V3c559b6d = $('curtain_contentLayer'+curtain.index);
var Ve6e48e35 = $('curtain_closeLayer'+curtain.index); var V79ad18f7 = getTopLeft(width, height); popUp.style.width = width+'px';
popUp.style.height = height+'px'; popUp.style.top = V79ad18f7[0]+'%'; popUp.style.left = V79ad18f7[1]+'%';
V3c559b6d.style.height = (height - Ve6e48e35.getHeight())+'px'; }, close: function(){ document.body.removeChild($('curtain_popUp'+curtain.index));
curtain.closeBlinds(); }, resize: function(){ var curtain_blinds = $('curtain_blinds'); var V1b808491 = getPageDim();
curtain_blinds.style.width = V1b808491[0] + 'px'; curtain_blinds.style.height = V1b808491[1] + 'px';
}, expand: function(){ curtain.expandView = true; var width = document.viewport.getWidth() - 25;
var height = document.viewport.getHeight() - 50; curtain.resizeContent(width, height); $('curtain_expand'+curtain.index).href = 'javascript:curtain.shrink()';
 }, shrink: function(){ curtain.expandView = false; $('curtain_expand'+curtain.index).href = 'javascript:curtain.expand()';
curtain.autoSize(); }, openBlinds: function(){ if( getIEVerNum() == 6){ curtain.hideSelects(); }
var curtain_blinds = $('curtain_blinds'); curtain.index +=2; curtain_blinds.style.zIndex = curtain.index;
curtain_blinds.style.display='block'; var V1b808491 = getPageDim(); curtain_blinds.style.width = V1b808491[0] + 'px';
curtain_blinds.style.height = V1b808491[1] + 'px'; Event.observe(window, 'resize', curtain.resize); 
 }, closeBlinds: function(){ var curtain_blinds = $('curtain_blinds'); curtain.index-=2; curtain_blinds.style.zIndex = curtain.index;
if(curtain.index == -1){ curtain_blinds.style.display='none'; Event.stopObserving(window, 'resize', curtain.resize); 
 } if( getIEVerNum() == 6){ curtain.showSelects(); } }, hideSelects: function(){ curtain.hideSelects[curtain.index] = new Array(); 
 if(curtain.index != -1){ var V68694ec3 = $('curtain_popUp'+curtain.index).select('select'); } else{ 
 var V68694ec3 = $$('select'); } for(var i=0; i < V68694ec3.length; i++){ if(V68694ec3[i].style.visibility != 'hidden'){
 V68694ec3[i].style.visibility = 'hidden'; curtain.hideSelects[curtain.index][i] = V68694ec3[i]; } }
}, showSelects: function(){ var V6861a8a7 = curtain.hideSelects[curtain.index]; for(var i=0; i < V6861a8a7.length; i++){
 V6861a8a7[i].style.visibility = 'visible'; } }, ajax: function(url, sameLayer){ if(!sameLayer){ curtain.load(); 
 } curtain.urls[curtain.index] = url; if(window.UR && url.include(window.UR)){url = window.UR +'/ajax'+ url.replace(window.UR, '');}else{url = window.CR +'/ajax'+ url.replace(window.CR, '');}
var V34d1c350 = Math.round(100000*Math.random()); if(url.include('?')){ url += '&k='+V34d1c350; }
else{ url += '?k='+V34d1c350; } new Ajax.Request(url, { method: 'get', onSuccess: function(ajaxReturn) {
 if(ajaxReturn.responseText == 'died'){ window.location = window.CR+'/action/died'; return;
} if(!sameLayer){ curtain.content(ajaxReturn.responseText); } else{ curtain.content(ajaxReturn.responseText, true);
} var newCurtain = $('curtain_contentLayer'+curtain.index); 
curtain.initLinks(newCurtain); externalLinks(newCurtain); if(valForm){ var forms = $(newCurtain).select('form[class*="val-form"]');
if(forms.length > 0){ valForm.init(forms[0].id); } } }}); }, refresh: function(prev){ if(prev){
 var V7f54f96b = curtain.index - 2; } else{ var V7f54f96b = curtain.index; } curtain.ajax(curtain.urls[V7f54f96b], true); 
 } }; 
 //Event.observe(window, 'load', curtain.init); 