function stristr( haystack, needle, bool ) {
    var pos = 0;
    haystack += '';
    pos = haystack.toLowerCase().indexOf( (needle+'').toLowerCase() );
    if( pos == -1 ){
        return false;
    } else{
        if( bool ){
            return haystack.substr( 0, pos );
        } else{
            return haystack.slice( pos );
        }
    }
}
	hs.allowMultipleInstances = false;
	hs.loadingText = 'laden';
	hs.loadingTitle = '';
	hs.focusTitle = '';
	hs.fullExpandTitle = '';
	hs.restoreTitle = '';
	hs.transitions = ['expand', ''];
	hs.outlineType = 'rounded-white';
	hs.fadeInOut = false;
	hs.wrapperClassName = 'borderless';
	hs.showCredits = false;
	hs.dimmingOpacity = 0.4;	


var counter = function(clef){
	Params = 'clef='+clef;
//	new Ajax.Updater(this, 'index.php?eID=baspino&id=458&action=ajax_click_meter', { method: 'get', parameters: Params });
	jQuery().ready(function()
	{
		jQuery.ajax({
				  url: 'index.php?type=6969',
				  data: 'action=ajax_click_meter&parameters=' + Params,
				  dataType: 'json',
				  type: 'post',
				  success: function (j) {
				  }
				});
	});
}
// Add the controlbar

hs.captionId = 'theCaption';
hs.captionEval = 'this.thumb.alt';
hs.headingEval = 'this.thumb.title';
hs.transitions = ['expand'];
hs.Expander.prototype.onMouseOut = function (sender) {
	if (sender.a.className == 'loggedin_user_options highslide-active-anchor')   sender.close();
};
hs.Expander.prototype.onAfterExpand = function (sender) {
	if (sender.a.className == 'loggedin_user_options highslide-active-anchor' && !sender.mouseIsOver) sender.close();
	if (stristr(sender.a.id,'profile_thumb'))
	{
	   var clef = this.a.id.replace(/^profile_thumb/, '');
	   if (clef) counter(clef);
	}
};
window.name = "main";

function calc(textfield,outputfield,maxLength,show_available_chars) {
	clipped = false;
	if (!maxLength) maxLength = 150;
	if (textfield.value.length > maxLength) {
		if (show_available_chars)
		{		
			textfield.value = textfield.value.substring(0,maxLength);
			charleft = 0;
			clipped = true;
			txtd = "Ndak isa nulis lagi";
		}
		else
		{
		}
	
	} else {
			charleft = maxLength - textfield.value.length;
			txtd = "Tersisa " + charleft + " karakter";
	}	
	if (show_available_chars)
	{
		outputfield.value = charleft;
	}
	else
	{
		outputfield.value = textfield.value.length;
	}
}

function CONFIRM(input)
{
				if (confirm(input))
				{
					return true;
				}
				else
				{
					return false;
				}
}
