Warning: include(system.php) [function.include]: failed to open stream: No such file or directory in /home/bavaria/public_html/js_common.php on line 26
Warning: include(system.php) [function.include]: failed to open stream: No such file or directory in /home/bavaria/public_html/js_common.php on line 26
Warning: include() [function.include]: Failed opening 'system.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/bavaria/public_html/js_common.php on line 26
/*
* System function definitions.
*
* Site wide common code for the system.
*
*/
/* trim function extension for string objects */
String.prototype.trim = function()
{
// skip leading and trailing whitespace
// and return everything in between
var x=this;
x=x.replace(/^\s*(.*)/, "$1");
x=x.replace(/(.*?)\s*$/, "$1");
return x;
}
/*
* Form get code.
*
* Organised here for future ease of maintence.
*
*/
/* returns the subscribe form object, used to avoid future code traversals if the form id changes */
function get_form_subscribe()
{
return document.getElementById('subscribe_form');
}
/*
* Gallery specific javascript code
*
*/
/* gallery image popup code to active a new popup window with appropriate properties */
function popup_gallery_image(iId, iWidth, iHeight)
{
/* calculate the top left co-ords */
iPosLeft = (screen.width - iWidth) / 2;
iPosTop = (screen.height - iHeight) / 2;
/* if the screen is too small for the popup, just make it as large as possible */
if (iPosLeft < 0) {
iPosLeft = 0;
iWidth = screen.width;
}
if (iPosTop < 0) {
iPosTop = 0;
iHeight = screen.height;
}
sUrl = 'SITE_URL/?action=gallery-popup&id=' + iId;
/* open and focus */
newWindow = window.open(sUrl, 'newWin', 'width='+iWidth+',height='+iHeight+',left='+iPosLeft+',top='+iPosTop+',toolbar=No,location=No,scrollbars=Yes,status=No,resizable=No,fullscreen=No'); newWindow.focus();
}
/*
* Subscribe form javascript code
*
*/
/* subscribe form default values */
var sSubscribeNameText = 'Your name';
var sSubscribeEmailText = 'Your email';
/* subscribe form text input on focus event handler, used to clear the default text when user clicks on the text field */
function onfocus_subscribe_text(sName, sDefaultText)
{
var oForm = get_form_subscribe();
var oTextField = oForm[sName];
if (oTextField.value == sDefaultText) {
oTextField.value = '';
}
}
/* subscribe form text input on blur event handler, used to restore the default text if user did not type anything */
function onblur_subscribe_text(sName, sText)
{
var oForm = get_form_subscribe();
var oTextField = oForm[sName];
if (oTextField.value.trim() == '') {
oTextField.value = sText;
}
}
/* join button in subscribe form */
function onclick_subscribe_button_submit()
{
var oForm = get_form_subscribe();
oForm.submit();
}