function OpenWin( url, name, newwidth, newheight, toReturn) {
	newx = (screen.availWidth - newwidth)/2;
	newy = (screen.availHeight - newheight)/2;
	winProps = 'dependent=yes, scrollbars=no, resizable=yes, status=no, directories=no, toolbar=no, location=no, menubar=yes';
	if ( toReturn ) {
		return window.open( url, name, winProps + ', width=' + newwidth + ', height=' + newheight + ', top=' + newy + ', left=' + newx);
	} else {
		window.open( url, name, winProps + ', width=' + newwidth + ', height=' + newheight + ', top=' + newy + ', left=' + newx);
	}
}

function verifyPropertyBoxOnFocus( itm ) {
  if ( isNaN(itm.value) ) {
    itm.value = '';
  } // end if
}
function verifyPropertyBoxOnBlur( itm ) {
  if ( isNaN(itm.value) || itm.value == '' ) {
    itm.value = 'Enter A Property #';
  }
}

function isNumberKey(evt)
{
	 var charCode = (evt.which) ? evt.which : event.keyCode
	 if (charCode > 31 && (charCode < 48 || charCode > 57))
			return false;

	 return true;
}

function swapIconMenuImage( itmID, pos, siteURL ) {
	document.getElementById('iconMenu_' + itmID + 'Img').src = siteURL + 'inc/tpl/site/img/iconMenu.'+ itmID +'.'+ pos +'.jpg';
} // end function
var panelList = new Array();
function togglePanel( panelID ) {
	if ( typeof(panelList[panelID]) == 'undefined' ) {
		panelList[panelID] = true;
	}
	if ( panelList[panelID] ) {
		Effect.BlindUp(panelID);
		panelList[panelID] = false;
	} else {
		Effect.BlindDown(panelID);
		panelList[panelID] = true;
	}
	return false;
}
function loadPage( pageName ) {
	switch( pageName ) {
	case 'registerForm':
		myLightWindow.activateWindow({
			title: 'Register Now',
			href: '../content/user/register/form.htm',
			width: 600,
			height: 600 });
	break;
	}
}


var urlEncode = {

    // public method for url encoding
    encode : function (string) {
        return escape(this._utf8_encode(string));
    },

    // public method for url decoding
    decode : function (string) {
        return this._utf8_decode(unescape(string));
    },

    // private method for UTF-8 encoding
    _utf8_encode : function (string) {
        string = string.replace(/\r\n/g,"\n");
        var utftext = "";

        for (var n = 0; n < string.length; n++) {

            var c = string.charCodeAt(n);

            if (c < 128) {
                utftext += String.fromCharCode(c);
            }
            else if((c > 127) && (c < 2048)) {
                utftext += String.fromCharCode((c >> 6) | 192);
                utftext += String.fromCharCode((c & 63) | 128);
            }
            else {
                utftext += String.fromCharCode((c >> 12) | 224);
                utftext += String.fromCharCode(((c >> 6) & 63) | 128);
                utftext += String.fromCharCode((c & 63) | 128);
            }

        }

        return utftext;
    },

    // private method for UTF-8 decoding
    _utf8_decode : function (utftext) {
        var string = "";
        var i = 0;
        var c = c1 = c2 = 0;

        while ( i < utftext.length ) {

            c = utftext.charCodeAt(i);

            if (c < 128) {
                string += String.fromCharCode(c);
                i++;
            }
            else if((c > 191) && (c < 224)) {
                c2 = utftext.charCodeAt(i+1);
                string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
                i += 2;
            }
            else {
                c2 = utftext.charCodeAt(i+1);
                c3 = utftext.charCodeAt(i+2);
                string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
                i += 3;
            }

        }

        return string;
    }

}

function displayFlashMovie(swfName, width, height, name, bgColor) {
	tmpOutput = '';
	tmpOutput += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="' + width + '" height="' + height + '" id="' + name + '" align="middle">';
	tmpOutput += '<param name="allowScriptAccess" value="sameDomain" />';
	tmpOutput += '<param name="movie" value="' + swfName + '" />';
	tmpOutput += '<param name="quality" value="high" />';
	tmpOutput += '<param name="wmode" value="transparent" />';
	tmpOutput += '<param name="bgcolor" value="#' + bgColor + '" />';
	tmpOutput += '<embed src="' + swfName + '" quality="high" wmode="transparent" bgcolor="#' + bgColor + '" width="' + width + '" height="' + height + '" name="' + name + '" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	tmpOutput += '</object>';
	
	document.write(tmpOutput);
}
