/**
 * @author zsolthorvath
 */
 
 var ie=document.all; 
 var actualImageId = '';
var imageReplacement = '';
			
var swapImageFunc = function() {
		var imageRef = dojo.byId(actualImageId);
		imageRef.src = imageReplacement;
		
		
}
	
var http = getHTTPObject();

function getHTTPObject() {
    if (typeof XMLHttpRequest != 'undefined') {
        return new XMLHttpRequest();
    }
    try {
        return new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
        try {
            return new ActiveXObject("Microsoft.XMLHTTP");
        } catch (e) {}
    }
    return false;
}

function onReadyStateChange() {
	if (http.readyState == 4) {
	    if (http.status == 200) {
	        document.location = 'linesheet/';
			createCookie('loginSuccess','yes',30);
	    } else {
	        alert("Incorrect username and/or password.");
	    }
	}
}

function login()
{
    var username = document.getElementById('oo-username').value;
    var password = document.getElementById('oo-password').value;
	
    this.http.open('get', 'linesheet/protect', true, username, password);
	this.http.onreadystatechange=onReadyStateChange;
    this.http.send("");
    return false;
}	
			
function swapImage(imageId, imageArray, index) {
	//dojo.require('dojo.fx');
	//var wipeOut = dojo.fx.wipeOut({node:'div0',duration:1000});
	//var wipeIn = dojo.fx.wipeIn({node:'div0',duration:500});
	//var wipeOutIn = dojo.fx.chain([wipeOut,wipeIn]);
	
	imageReplacement = imageArray[index].src;
	actualImageId  = imageId;
	
	//dojo.connect(wipeOut, 'onEnd', swapImageFunc);
	
	//wipeOutIn.play();
	
	swapImageFunc();
}

function swapPressImage(imgId, imgArray, titleArray, lCurrentPressIndex, diff) {
	var objImg = dojo.byId(imgId);
	if (diff == 0) {
		currentPressIndex = parseInt(getParameter(window.location.search, 'index'));
	}
	else {
		currentPressIndex = lCurrentPressIndex + diff;
	}

	objImg.src = imgArray[currentPressIndex].src;
	dojo.byId('pressTitle').innerHTML = titleArray[currentPressIndex];
	
	//Disable links
	if (currentPressIndex == 0)
		dojo.byId('prevPressDiv').style.display = 'none';
	else
		dojo.byId('prevPressDiv').style.display = 'block';
		
	if (currentPressIndex == imgArray.length-1)
		dojo.byId('nextPressDiv').style.display = 'none';
	else
		dojo.byId('nextPressDiv').style.display = 'block';
	
	return false;
}

function borderit(which, color){
	//if IE 4+ or NS 6+
	if (document.all || document.getElementById) {
		which.style.borderColor = color
	}
}

var pressWindow;

function openPressWindow(index) {
	if (pressWindow != null && !pressWindow.closed) {
		pressWindow.location.href = '/magazins.htm?index='+index;
		pressWindow.focus();
	}
	else {
		pressWindow = window.open("/magazins.htm?index=" + index, "mywindow", "width=600,height=600");
	}
}

 
function position(){
	//var outerDiv = document.getElementById('outerDiv');
	var innerDiv = document.getElementById('innerDiv');
	var popupDiv = document.getElementById('popupDiv');
	var popupDiv2 = document.getElementById('popupDiv2');
	var popupDiv3 = document.getElementById('popupDiv3');
	var popupDiv4 = document.getElementById('popupDiv4');
	var popupDiv5 = document.getElementById('popupDiv5');
	var popupDiv6 = document.getElementById('popupDiv6');
	var top;
	var left;
	
	if (navigator.appName.indexOf("Microsoft") != -1) {
		top = (document.documentElement.clientHeight - 600) / 2;
		left = (document.documentElement.clientWidth - 800) / 2;
	}
	else {
		top = (window.innerHeight - 600) / 2;
		left = (window.innerWidth - 800) / 2;
	}
	
	if (top < 10) 
		top = 10;
	
	//outerDiv.style.paddingTop = top+'px';
	innerDiv.style.top = top + 'px';
	innerDiv.style.left = left + 'px';
	if (popupDiv != null) {
		popupDiv.style.top = top + 'px';
		popupDiv.style.left = left + 'px';
	}

	if (popupDiv2 != null) {
		popupDiv2.style.top = top+'px'; 
		popupDiv2.style.left = left+'px'; 
	}
	if (popupDiv3 != null) {
		popupDiv3.style.top = top+'px'; 
		popupDiv3.style.left = left+'px'; 
	}
	
	if (popupDiv4 != null) {
		popupDiv4.style.top = top+'px'; 
		popupDiv4.style.left = left+'px'; 
	}

	if (popupDiv6 != null) {
		popupDiv6.style.top = top+'px'; 
		popupDiv6.style.left = left+'px'; 
	}

	if (popupDiv5 != null) {
		popupDiv5.style.top = top+'px'; 
		popupDiv5.style.left = left+'px'; 
	}
}

function changeZIndex(popupid, index, visible) {
	var popupDiv = document.getElementById(popupid);
	if (popupDiv) {
		popupDiv.style.zIndex = index;
		popupDiv.style.visibility = visible;
	}
}

function showPress() {
	changeZIndex('popupDiv6',994,'hidden');
	changeZIndex('popupDiv5',995,'hidden');
	changeZIndex('popupDiv4',996,'hidden');
	changeZIndex('popupDiv',999,'hidden');
	changeZIndex('popupDiv2',998,'hidden');
	changeZIndex('popupDiv3',1001,'visible');
}

function showStoreList() {
	changeZIndex('popupDiv6',994,'hidden');
	changeZIndex('popupDiv5',995,'hidden');
	changeZIndex('popupDiv4',996,'hidden');
	changeZIndex('popupDiv2',998,'hidden');
	changeZIndex('popupDiv3',997,'hidden');
	changeZIndex('popupDiv', 1001,'visible');
}

function showLogin() {
	var login = readCookie('loginSuccess');
	if (login==null) {
		changeZIndex('popupDiv6',994,'hidden');
		changeZIndex('popupDiv5',995,'hidden');
		changeZIndex('popupDiv4', 996, 'hidden');
		changeZIndex('popupDiv', 999, 'hidden');
		changeZIndex('popupDiv3', 997, 'hidden');
		changeZIndex('popupDiv2', 1001, 'visible');
	} else
        document.location = 'linesheet/';
	
}

function showAbout() {
	changeZIndex('popupDiv6',994,'hidden');
	changeZIndex('popupDiv5',995,'hidden');
	changeZIndex('popupDiv',999,'hidden');
	changeZIndex('popupDiv3',997,'hidden');
	changeZIndex('popupDiv2',998,'hidden');
	changeZIndex('popupDiv4',1001,'visible');
}

function showSales() {
	changeZIndex('popupDiv6',994,'hidden');
	changeZIndex('popupDiv',999,'hidden');
	changeZIndex('popupDiv3',997,'hidden');
	changeZIndex('popupDiv2',998,'hidden');
	changeZIndex('popupDiv4',999,'hidden');
	changeZIndex('popupDiv5',1001,'visible');
}

function showTerms() {
	changeZIndex('popupDiv6',1001,'visible');
	changeZIndex('popupDiv',999,'hidden');
	changeZIndex('popupDiv3',995,'hidden');
	changeZIndex('popupDiv2',996,'hidden');
	changeZIndex('popupDiv4',997,'hidden');
	changeZIndex('popupDiv5',994,'hidden');
}

function showOrder() {
	changeZIndex('popupDiv6',994,'hidden');
	changeZIndex('popupDiv5',995,'hidden');
	changeZIndex('popupDiv4',996,'hidden');
	changeZIndex('popupDiv',999,'hidden');
	changeZIndex('popupDiv2',998,'hidden');
	changeZIndex('popupDiv3',1001,'visible');
}

function showReturnExchanges() {
	changeZIndex('popupDiv6',994,'hidden');
	changeZIndex('popupDiv5',995,'hidden');
	changeZIndex('popupDiv4',996,'hidden');
	changeZIndex('popupDiv2',998,'hidden');
	changeZIndex('popupDiv3',997,'hidden');
	changeZIndex('popupDiv', 1001,'visible');
}


function closePopup() {
	changeZIndex('popupDiv6',994,'hidden');
	changeZIndex('popupDiv5',995,'hidden');
	changeZIndex('popupDiv4',996,'hidden');
	changeZIndex('popupDiv',999,'hidden');
	changeZIndex('popupDiv2',998,'hidden');
	changeZIndex('popupDiv3',997,'hidden');
	
}

if (!this.PR) {
	PR = {};
	PR.popupRegistry = new popupRegistry();
}


function popupRegistry(){
	this.popups = new Array();
	
	this.registerPopup = function (popupName){
		found = false;
		for (i=0; i<this.popups.length && !found; i++) {
			if (this.popups[i] == popupName)
				found = true;
		}
		
		if (!found)
			this.popups.push(popupName);
	}
	
	this.showPopup = function (popupName){
		for (i = 0; i < this.popups.length; i++) {
			var popupDiv = dojo.byId(popupName);
			if (popupDiv != null) {
				var index = 999;
				if (this.popups[i] == popupName) {
					this.positionPopup(popupDiv);
					changeZIndex(this.popups[i], 1001, 'visible');
				} else {
					changeZIndex(this.popups[i], index--, 'hidden');
				}
			}
		}	
	}
	
	this.positionPopup = function (popupDiv) {
		if (popupDiv != null) {
			var divWidth = parseInt(popupDiv.style.width);
			var divHeight = parseInt(popupDiv.style.height);
			if (navigator.appName.indexOf("Microsoft") != -1) {
				topPos = parseInt((document.documentElement.clientHeight - divHeight) / 2 - 20);
				leftPos = parseInt((document.documentElement.clientWidth - divWidth) / 2);
			}
			else {
				topPos = parseInt((window.innerHeight - divHeight) / 2 - 20);
				leftPos = parseInt((window.innerWidth - divWidth) / 2);
			}
			
			if (topPos < 10) 
				topPos = 10;
				
			popupDiv.style.left = leftPos+'px';
			popupDiv.style.top = topPos+'px';
		}

	}
	
	this.closePopups = function() {
		for (i = 0; i < this.popups.length; i++) {
			var index = 999;
			changeZIndex(this.popups[i], index--, 'hidden');
			
		}	
		
	}
}

function changeProductDetails(divId, newText) {
	var divVar = dojo.byId(divId);
	divVar.innerHTML = newText;
}


//function writeSales() {
    //alert('Writing');
	//var sales = dojo.byId('sales');
	//sales.style.height = 310+'px';
	//sales.style.width = 500+'px';
	//sales.innerHTML = '\
	  //<div align="center">\
	    //<table width="490" cellpadding="0" cellspacing="8" class="tablazat">\
          //<tr align="left">\
            //<td align="right"><a href="javascript:closePopup();" class="tablazat-2" style="text-decoration:none "><strong>X</strong></a></td>\
          //</tr>\
          //<tr align="left" class="whitebold">\
		  	//<td style="padding: 0px;text-align:center;">USA<br/>BLUEBIRD SHOWROM<br/>860 S Los Angeles St. 204.<br/>Los Angeles, CA 90014<br/>\
			//Tel: 213 624 6040<br/>Fax: 310 388 3260</td>\
          //</tr>\
		   //<tr align="left" class="whitebold">\
		  	//<td style="padding: 0px;text-align:center;"><br><br>SPAIN<br/>C2SHOWROOM<br/>Claudio Coello 46, S.1<br/>28001 Madrid<br/>\
			//Email: <a class="tablazat" style="text-decoration:none" href="mailto:info@c2showroom.es">info@c2showroom.es</a><br>Tel: +34 91 435 82 67<br/>Fax: +34 91 435 54 54<br>\
			//<a class="tablazat" style="text-decoration:none" href="http://www.c2showroom.es" target="_blank">www.c2showroom.es</a>\
			//</td>\
          //</tr>\
        //</table>\
      //</div>\
	//';
//}

function writePressList() {
	//alert('Writing');
	var presslist = dojo.byId('presslist');
	//var pressList = document.getElementById('presslist');
	presslist.style.height = 450+'px';
	presslist.innerHTML = '\
	   <div align="center">\
	    <table width="650" cellpadding="0" cellspacing="8" class="tablazat" border="0">\
          <tr align="left">\
            <td>&nbsp;</td>\
            <td align="right"><a href="javascript:closePopup();" class="tablazat-2" style="text-decoration:none "><strong>X</strong></a></td>\
          </tr>\
          <tr align="center" class="whitebold">\
            <td><span><strong>ONE OCTOER IN THE PRESS</strong></span></td>\
          </tr>\
          <tr align="center">\
            <td><span><a href="javascript:openPressWindow(0);" class="tablazat">Flaunt #94, June 2008 - Cover</a></tr>\
          <tr align="center" class="tablazat-2">\
            <td><span><a href="javascript:openPressWindow(1);" class="tablazat">Flaunt #94, June 2008</a></span></td>\
          </tr>\
          <tr align="center">\
            <td><span><a href="javascript:openPressWindow(2);" class="tablazat">Life &amp; Style, June 23, 2008 - Cover</a></span></td>\
          </tr>\
          <tr align="center" class="tablazat-2">\
            <td><span><a href="javascript:openPressWindow(3);" class="tablazat">Life &amp; Style, June 23, 2008 - Carmella Burgundy Patent</a></span></td>\
          </tr>\
        </table>\
      </div>\
	';
}

function writeAbout() {
	var about = dojo.byId('about');
	about.style.height = 450+'px';
	about.innerHTML = '\
    <div align="center">\
      <table width="620" cellpadding="5" cellspacing="0">\
        <tr>\
          <td width="620"><img src="images/empty.gif" height="20" width="620" /></td>\
          <td style="text-align:center;"><a href="javascript:closePopup();" \
		  class="tablazat-2" style="text-decoration:none "><strong>X</strong></a></td>\
        </tr>\
        <tr>\
        	<td colspan="2" height="1"></td>\
        </tr>\
        <tr align="left">\
          <td colspan="2" class="tablazat" align="center"><strong>one october</strong><br><br>\
		  </td>\
        </tr>\
		<tr align="left">\
          <td colspan="2" class="tablazat" style="padding:15px" style="text-align:justify" align="justify">\
          <p>ONE OCTOBER  is a bag and accessory line whose goal is to create designs that are classic and timeless with \
		  an edge.</p>\
		  <p>By incorporating salmon skin into our designs we have created a collection that environmentally conscious \
		  consumers can feel positive about carrying. Most exotic leathers are obtained from skins of endangered species. \
		  Salmon skin is only an industrial residue from the farmed salmon industry but it is considered "exotic" leather.  \
		  By using salmon leather, ONE OCTOBER aims to deliver high fashion and quality, in an environmentally sustainable way.</p> \
		  <p>ONE OCTOBER is owned by Roxana Zal and Naomi Stokeld. Roxana was born in Malibu, California.  An actress for most \
		  of her life, she has always been drawn to fashion in front of and behind the camera. Between filming she started \
		  designing and doing PR for fashion companies. Her creativity and passion for design inspired her to create her own \
		  fashion line.  Naomi was born in Santa Cruz, California and grew up in Latin America.  While living in Chile, she became an \
		  attorney, but like Roxana, had an eye for fashion and new trends.  In Chile she discovered the superior qualities \
		  and unique beauty of salmon leather.  After moving to Los Angeles where she is a corporate lawyer, she met Roxana. \
		  Together they decided to combine their talents, expertise, and resources to create ONE OCTOBER.</p>\
        </tr>\
		<tr align="left">\
          <td colspan="2" class="tablazat" style="padding:15px"  align="right"><a class="tablazat" \
		  style="text-decoration:none" href="mailto:info@oneoctober.net">info<span class="tablazat-2">@</span>oneoctober.net<br></a></a></td>\
        </tr>\
        <tr>\
        	<td colspan="2" height="10" ></td>\
        </tr>\
      </table>\
    </div>';
	
}

function writeTerms() {
	var terms = dojo.byId('popupTerms');
	terms.innerHTML = '\
<div align="center">\
      <table width="860" cellpadding="5" cellspacing="0">\
        <tr>\
          <td width="840" height="20"><img src="../images/empty.gif" height="20" /></td>\
          <td style="text-align:right;" height="20"><a href="#" onclick="PR.popupRegistry.closePopups();" \
		  class="tablazat-2" style="text-decoration:none "><strong>X</strong></a></td>\
        </tr>\
        <tr align="left">\
          <td colspan="2" class="tablazat" align="center"><strong>Terms & Conditions </strong><br/>\
		  </td>\
        </tr>\
		<tr align="left">\
          <td colspan="2" class="tablazat" style="padding:0px 10px 20px 10px" style="text-align:justify" align="justify">\
          <p>Please read these terms and conditions carefully, they contain important information about your rights and obligations. </p>\
		  <p>Nature of our Website</p>\
<p>The purchase of products from ONE OCTOBER\'S website is strictly limited to parties who can lawfully enter into and form contracts on this website in accordance with California Law.</p>\
<p>Buying Products on our Website</p>\
<p>1. To order a product you will need to follow the ordering procedures set out on our order page. Details and procedures for payment and delivery are displayed on our website, under "Order and Delivery".</p>\
<p>2. Any times or dates stated on our website for delivery are estimates only. ONE OCTOBER will make all reasonable effort to deliver goods within the time specified, but does not accept liability for any failure to deliver within that time.</p>\
<p>3. You must pay by PayPal or credit card once we have sent an email confirming your order. The price of any Product is the price in force at the date and time of your order.</p>\
<p>4. We may change the price of any Product before you place an order. We try to ensure that our prices displayed on our website are accurate but the price on your order will need to be validated by us as part of the acceptance procedure. We will inform you if a Product\'s correct price is higher than that stated in your order and you may cancel the order and decide whether or not to order the product at the correct price. Prices shown on our website are in US dollars. The prices are exclusive of taxes and delivery costs.</p>\
<p>5. All orders are subject to acceptance and availability. ONE OCTOBER is entitled to refuse any order placed by you. The contract for sale is accordingly concluded in Los Angeles, California and the language of the contract is English.</p>\
<p>6. ONE OCTOBER reserves the right not to accept your order in the event that we are unable to obtain authorization for payment, items ordered are out of stock, or you fail to meet the eligibility criteria set out in these conditions.</p>\
<p>7. ONE OCTOBER may, at its sole discretion, refuse services to anyone at any time. On doing so it will not be liable to you or any third party on any account whatsoever.</p>\
<p>8. Unless you provide ONE OCTOBER with a valid and correct tax exemption certificate applicable to your purchase, you are responsible for sales and other taxes associated with your order.</p>\
      </table>\
    </div>';
	
}

function writeOrder() {
	var order = dojo.byId('popupOrderDelivery');
	order.innerHTML = '\
<div align="center">\
      <table width="700" cellpadding="5" cellspacing="0">\
        <tr>\
          <td width="680"><img src="../images/empty.gif" height="20" width="620" /></td>\
          <td style="text-align:center;"><a href="#" onclick="PR.popupRegistry.closePopups();" \
		  class="tablazat-2" style="text-decoration:none "><strong>X</strong></a></td>\
        </tr>\
        <tr>\
        	<td colspan="2" height="1"></td>\
        </tr>\
        <tr align="left">\
          <td colspan="2" class="tablazat" align="center"><strong>Order & Delivery </strong><br><br>\
		  </td>\
        </tr>\
		<tr align="left">\
          <td colspan="2" class="tablazat" style="padding:15px" style="text-align:justify" align="justify">\
          <p>We accept payments through PayPal and mayor credit cards.  </p>\
		  <p>Upon receipt of your purchase request, ONE OCTOBER will send you an email confirming your order and requesting payment through PayPal portal.</p>\
<p>ONE OCTOBER reserves the right not to accept your order in the event that we are unable to obtain authorization for payment, items ordered are out of stock, or you fail to meet the eligibility criteria set out in these conditions.</p>\
<p>Shipping costs will be calculated depending on the size, weight and destination of your package. All shipping outside Los Angeles, CA is handled by carrier UPS. All cost of shipping will be calculated and invoiced prior to shipment. </p>\
<p>ONE OCTOBER will endeavor to deliver all goods within the time specified but accepts no liability for any late delivery. </p>\
<p>Your order will be shipped once:<br/>\
1. Payment has been approved.<br/>\
2. The delivery/billing address has been verified. </p>\
<p>In calculating when your order will arrive, start with the day in which the above prerequisites have been met and count 7-10 business days thereafter. </p>\
      </table>\
    </div>';
	
}


function writeReturnExchanges() {
	var returnexchanges = dojo.byId('popupReturnExchanges');
	returnexchanges.innerHTML = '\
<div align="center">\
      <table width="660" cellpadding="5" cellspacing="0">\
        <tr>\
          <td width="640"><img src="../images/empty.gif" height="20" width="620" /></td>\
          <td style="text-align:center;"><a href="#" onclick="PR.popupRegistry.closePopups();" \
		  class="tablazat-2" style="text-decoration:none "><strong>X</strong></a></td>\
        </tr>\
        <tr>\
        	<td colspan="2" height="1"></td>\
        </tr>\
        <tr align="left">\
          <td colspan="2" class="tablazat" align="center"><strong>Return &amp; Exchanges</strong><br><br>\
		  </td>\
        </tr>\
		<tr align="left">\
          <td colspan="2" class="tablazat" style="padding:15px" style="text-align:justify" align="justify">\
		  <p>ONEOCTOBER offers only the highest quality products. In the unlikely event that you are not satisfied with your purchase or require an exchange, simply send an email to sales@oneoctober.net indicating the reason for return of the items. You will receive a reply with the necessary steps for you to return your items.</p>\
		  <p>Return the item in its original, unused condition (including all original plastic packaging and tags) within 15 days of receipt for a full refund, less shipping costs.</p>\
		  <p>If you have any questions or concerns regarding your order, please email to sales@oneoctober.net</p>\
		  <p>Please allow 7 business days for returns to be processed once they reach our warehouse and a further 3 days for any refund to appear in your account.</p>\
		  <p>ONE OCTOBER also reserves the right to refuse any excessive and/or bad faith returns.</p>\
		  <p>Merchandise for return must be unworn, unwashed, and in original condition.</p>\
		  <p>Please send returns to:<br/>ONE OCTOBER<br/>1504 McCollum Street,<br/>Los Angeles, CA 90026</p>\
       </table>\
    </div>';
	
}

function createCookie(name,value,minutes) {
	if (minutes) {
		var date = new Date();
		date.setTime(date.getTime()+(minutes*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function getParameter(queryString, parameterName){
    // Add "=" to the parameter name (i.e. parameterName=value)
    var parameterName = parameterName + "=";
    if (queryString.length > 0) {
        // Find the beginning of the string
        begin = queryString.indexOf(parameterName);
        // If the parameter name is not found, skip it, otherwise return the value
        if (begin != -1) {
            // Add the length (integer) to the beginning
            begin += parameterName.length;
            // Multiple parameters are separated by the "&" sign
            end = queryString.indexOf("&", begin);
            if (end == -1) {
                end = queryString.length
            }
            // Return the string
            return unescape(queryString.substring(begin, end));
        }
        // Return "null" if no parameter has been found
        return "null";
    }
}

function hideCollectionsMenu(e) {
	source=ie? event.srcElement : e.target;
	var divColl = document.getElementById('collections');
	if (ie&&divColl!=source&&!divColl.contains(source))
	{
		document.getElementById('collectionsmenu').style.display='none';
	} else if (!ie&&divColl!=source&&!contains_node(divColl,source)) {
		document.getElementById('collectionsmenu').style.display='none';
	}
}

function contains_node(master, slave) { //check if slave is contained by master
while (slave.parentNode)
if ((slave = slave.parentNode) == master)
return true;
return false;
} 

function showDijitDialog(id) {
  var dialog = dijit.byId(id);
  dialog.closeText.innerHTML = 'X';
  dialog.closeText.style.display = 'inline';
  dialog.closeText.title = 'Close';
  dialog.show();
}

function submitSubscription() {
	//Check emial first
	var email = dojo.byId('subscribeEmail').value;
	var errorDiv = dojo.byId('subscribeError');
	if (email.match(/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]+/) != null) {
		errorDiv.innerHTML = '<span style="color: green"><strong>Sending subscription... Please wait...</strong></span>';
		errorDiv.style.display = 'block';
		setTimeout(function(){dojo.byId('subscribeform').submit()}, 500);
	} else {
		//Invalid e-mail address
		errorDiv.innerHTML = '<span style="color: white"><strong>Invalid e-mail address!</strong></span>'
		errorDiv.style.display = 'block';
	}
}

function triggerOnClickOnKeyPress(sourceElement, e) {
    var isEnter = window.event == null ? 
                  e.keyCode == 13 : 
                  window.event.keyCode == 13;
    if(isEnter) {
        dojo.byId(sourceElement).onclick();
        return false;
    } else
    	return true;
}


function switchAbout(ids, buttons, selectedId) {
		for (i=0; i<ids.length; i++) {
			var element = dojo.byId(ids[i]);
			var button = dojo.byId(buttons[i]);
			if (element.id == selectedId || (selectedId == null && element.style.display == 'none')) {
				element.style.display = 'block';
				button.style.display = 'inline';
			} else if (element.id != selectedId || (selectedId == null && element.style.display == 'block')) {
				element.style.display = 'none';
				button.style.display = 'none';
			}
		}
}
