String.prototype.pad = function(l, s, t){    if ((l -= this.length) > 0)	{	if (!s) s = " ";	if (t==null) t = 1;	s = s.repeat(Math.ceil(l / s.length));	var i = t==0 ? l : (t == 1? 0 : Math.floor(l / 2));	s= s.substr(0, i) + this + s.substr(0, l - i);	return s;    }    else return this;}String.prototype.repeat = function(n){    return new Array( n + 1 ).join(this);}function createRequest() {    try {	request = new XMLHttpRequest();    } catch (tryMS) {	try {	    request = new ActiveXObject("Msxml2.XMLHTTP");	} catch (otherMS) {	    try {		request = new ActiveXObject("Microsoft.XMLHTTP");	    } catch (failed) {		request = null;	    }	}    }    return request;}//---------------------------------------------------------//function getActivatedObject(e) {    var obj;    if (!e) {	// early version of IE	obj = window.event.srcElement;    } else if (e.srcElement) {	// IE 7 or later	obj = e.srcElement;    } else {	// DOM Level 2 browser	obj = e.target;    }    return obj;}//---------------------------------------------------------///* * Example addEvent(window, "load", sortables_init);*/function addEvent(elm, evType, fn, useCapture){    if (elm.addEventListener) {	elm.addEventListener(evType, fn, useCapture);	return true;    }    else    if (elm.attachEvent) {	var r = elm.attachEvent("on" + evType, fn);	return r;    }}//---------------------------------------------------------////---------------------------------------------------------////function toggles enabled - disabled attr of fields with passed idsfunction disableInputs(){    if (arguments.length > 0) {	for(var i = 0; i < arguments.length; i++) {	    $('#' + arguments[i]).attr('disabled', true).attr('class', 'inactive').attr('className', 'inactive');	}    }}//---------------------------------------------------------////function enables between enabled - disabled of fields with passed idsfunction enableInputs(){    if (arguments.length > 0) {	for(var i = 0; i < arguments.length; i++)	{	    $('#' + arguments[i]).attr('disabled', false).attr('class', 'active').attr('className', 'active');	}    }}//---------------------------------------------------------//var flatss;function initCalendar(id, fl){    if(fl == undefined || fl == ''){	flatss = '';	Calendar.setup({	    inputField: id, // id of the input field	    ifFormat: "%Y-%m-%d %H:%M", // format of the input field	    showsTime: true,	    timeFormat: "24",	    singleClick: true,	    date: new Date(),	    disableFunc: function(calDate){		var today = new Date();		if ((calDate - today) < 0 ) {		    return true;		}	    }	});    } else {	flatss = fl;	Calendar.setup({	    inputField: id, // id of the input field	    ifFormat: "%Y-%m-%d %H:%M", // format of the input field	    showsTime: true,	    timeFormat: "24",	    singleClick: true,	    date: new Date(),	    position : [0, 0],	    disableFunc: function(calDate){		var today = new Date();		if ((calDate - today) < 0 ) {		    return true;		}	    }	});    }    $(document.getElementById(id)).bind('click', function(){	if($.browser.msie && $.browser.version <= 8){//if IE version under 8	    if (document.getElementById('first_order')){//if this is registration page		$('.calendar').css('top', '920px')	    }	}    })}//---------------------------------------------------------//function initAdminCalendar(id){    Calendar.setup({	inputField: id, // id of the input field	ifFormat: "%Y-%m-%d %H:%M", // format of the input field	showsTime: true,	timeFormat: "24",	singleClick: true,	date: new Date()    });}//---------------------------------------------------------//function initCalendar_DateOnly(id){    Calendar.setup({	inputField: id, // id of the input field	ifFormat: "%Y-%m-%d", // format of the input field	showsTime: true,	timeFormat: "24",	singleClick: true,	date: new Date()    });}//---------------------------------------------------------//function getdate (timestamp) {    // Get date/time information    // version: 910.813    // discuss at: http://phpjs.org/functions/getdate    // *     example 1: getdate(1055901520);    // *     returns 1: {'seconds': 40, 'minutes': 58, 'hours': 21, 'mday': 17, 'wday': 2, 'mon': 6, 'year': 2003, 'yday': 167, 'weekday': 'Tuesday', 'month': 'June', '0': 1055901520}    var _w = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];    var _m = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];    var d=(	(typeof(timestamp) == 'undefined') ? new Date() : // Not provided	(typeof(timestamp) == 'object') ? new Date(timestamp) : // Javascript Date()	new Date(timestamp*1000) // UNIX timestamp (auto-convert to int)	);    var w = d.getDay();    var m = d.getMonth();    var y = d.getFullYear();    var r = {};    r.seconds = d.getSeconds();    r.minutes = d.getMinutes();    r.hours = d.getHours();    r.mday = d.getDate();    r.wday = w;    r.mon = m + 1;    r.year = y;    r.yday = Math.floor((d - (new Date(y, 0, 1))) / 86400000);    r.weekday = _w[w];    r.month = _m[m];    r['0'] = parseInt(d.getTime() / 1000, 10);    return r;}//-----------------------------------------------------------////object converter: array to objectfunction oc(a){    var o = {};    for(var i=0;i<a.length;i++){	o[a[i]]='';    }    return o;}//--------------------------------------------------------//function toggleDiv(div, invoker){    if ($(div).css('display') != 'none'){	$(div).slideUp();	$(invoker).attr('class', 'scr_show')    } else {	$(div).slideDown()	$(invoker).attr('class', 'scr_hide')    }}//-----------------------------------------------------------//function initTooltips(cont_sel){    $(cont_sel).each(function(){	if (document.getElementById($(this).attr('id') + '_tooltip') && $('#' + $(this).attr('id') + '_tooltip').html().length > 0) {	    $(this).tooltip({		track: true,		delay: 0,		fade: 100,		bodyHandler: function() {		    return $('#' + $(this).attr('id') + '_tooltip').html();		},		showURL: false	    })	}    });}//-----------------------------------------------------------//function initColumnTooltip(col_sel){    $(col_sel).each(function(){	if (document.getElementById('span_' + $(this).attr('id')) && $('#span_' + $(this).attr('id')).html().length > 0) {	    $(this).tooltip({		track: true,		delay: 0,		fade: 100,		bodyHandler: function() {		    return $('#span_' + $(this).attr('id')).html();		},		showURL: false	    })	}    });}//------------------------------------------------------------//function setClass(elm, classs){    $(elm).attr('class', classs);}//---------------------------------------------------------///** function used to toggle between two input fields - type=text & type=pass* @event onfocus of fake field* @param id1 - fake field id* @param id2 - real field id*/function toggleFakeInput(id1, id2){    var obj1 = document.getElementById(id1);    var obj2 = document.getElementById(id2);    toggleVisibility(obj1);    toggleVisibility(obj2);    obj2.focus();}//---------------------------------------------------------///** function used to toggle between two input fields - type=text & type=pass* @event onblur of pass field* @param id1 - fake field id* @param id2 - real field id*/function togglePass(id1, id2){    var obj1 = document.getElementById(id1);    var obj2 = document.getElementById(id2);    if (obj2.value == '') {	$(obj1).css('display', '');	$(obj2).css('display', 'none');    }}//---------------------------------------------------------///* * changes display property of the object */function toggleVisibility(obj){    if(obj.style.display == '' || obj.style.display == 'block' || obj.style.display == 'inline') {	obj.style.display = 'none';    } else {	obj.style.display = '';    }}//---------------------------------------------------------//function createDropDown(container){    var source = $(container).find('select');//select    var selected = source.find("option:selected");//selected option    var options = $("option", source);//all options    $(container).append('<dl id="'+ source.attr('id') + '_fdd" class="dropdown"></dl>')    $("#" + source.attr('id') + '_fdd').append('<dt><a href="javascript:void(0)">' + selected.text() + '<span class="value">' + selected.val() + '</span></a></dt>').append('<dd><ul></ul></dd>')    options.each(function(){	if ($(this).text().length > 0) {	    $(container).find('dd ul').append('<li><a href="javascript:void(0)">' + $(this).text() + '<span class="value">' + $(this).val() + '</span></a></li>');	}    });    $(container).find(".dropdown dt a").click(function() {	if ($(container).find(".dropdown dd ul li").size() > 0) {	    $(container).find(".dropdown dd ul").slideToggle('fast');	}    });    if ($(container).find(".dropdown dd ul").height() > 200){	$(container).find(".dropdown dd ul").css({	    'height':'200px',	    'overflow-y':'scroll'	})    }    source.css('display', 'none')    $(container).find(".dropdown dd ul").css('display', 'none');    $(container).find(".dropdown dd ul li a").click(function() {	var text = $(this).html();	$(container).find(".dropdown dt a").html(text);	$(container).find(".dropdown dd ul").slideUp('fast');	source.val($(this).find("span.value").html()).change()    });}//--------------------$.getDocHeight = function(){    return Math.max(	$(document).height(),	$(window).height(),	/* For opera: */	document.documentElement.clientHeight	);};