function checkEmail(email)
{
  emailTest = "^[_\\.0-9A-Za-z-]+@([0-9a-zA-Z][0-9A-Za-z_-]+\\.)+[a-zA-Z]{2,4}$";
  var regex = new RegExp(emailTest);
  if (!regex.test(email) || !(email.length > 0)) {return 0} else {return 1}
}

function setCookie( sName, vValue, dExpires ){
   document.cookie = sName + "=" + escape( vValue );
   + ( ( dExpires == null ) ? "" : ( "; expires=" + dExpires.toGMTString() ) );
   + "; path=/";
}

function getCookie( sName ){
    return pairsStringGetValue( document.cookie, sName );
}


function pairsStringGetValue( sText, sName, sFrom, sBefore ){
    var sValue = "";
    if( sText ){
        if( !sFrom ) sFrom = "=";
        if( !sBefore ) sBefore = ";";
        sText = sText.replace( new RegExp( "(" + sBefore + ")\\s+", "g" ), "$1" );
        var iStart = sText.indexOf( sBefore + sName + sFrom );
        if( iStart >= 0 ){
            iStart += ( sBefore.length + sName.length + sFrom.length );
        }else{
            iStart = sText.indexOf( sName + sFrom );
            if( iStart == 0 ){
				iStart += ( sName.length + sFrom.length );
			}else{
				iStart = -1;
			}
		}
		if( iStart >= 0 ){
			var iEnd = sText.indexOf( sBefore, iStart );
			if( iEnd < 0 ){
				iEnd = sText.length;
			}
			sValue = sText.substring( iStart, iEnd );
		}
	}
	return sValue;
}


function tabSwitch(span) {
	var td = span.parentNode;
    var td_class = td.className;
	var tr = td.parentNode;
	for (var i = 0; i < tr.childNodes.length; i++) {
		if (tr.childNodes[i].nodeType == 1) {
			var label = tr.childNodes[i];
			if (label.className == "ignore") continue;
			var layer = document.getElementById("tab-switch-layer" + label.id.replace("tab-switch-label", ""));
			label.className = label.className.replace(/\s?tab-switch-label-active/, "");
			layer.className = layer.className.replace(/\s?tab-switch-layer-active/, "");
			if ((label == td)  && (label.className == td_class)) {
				label.className += " tab-switch-label-active";
				layer.className += " tab-switch-layer-active";
			}
		}
	}
}

var imgWindow;
function openImage(url,width,height) {
  width += 20;
  height += 20;
  imgWindow=window.open(url,'Image','scrollbars=auto,status=no,location=no,menubar=no,toolbar=no,resizable=no,width='+width+',height='+height);
  imgWindow.focus();
  void(0);
}
