$.fn.extend({
jfocus: function(){
$(this).each(function(){
var $init = $(this).val();
$(this).focus(function(){
if ($(this).val() == $init){
$(this).val("");
}
});
$(this).blur(function(){
if ($init == $(this).val() || $(this).val() == "")
{
$(this).val($init);
}
});
});
}
});
var _encoder = {
Decode: function (arr)
{
var str = "";
for (var i = 0; i < arr.length; i++)
{
str += String.fromCharCode(arr[i]);
}
return decodeURI(str);
}
};
var _qFeed =
{
Increment: 0,
IntervalHandler: '',
Transition: 7000,
ObjectID: "#quotes",
TitleTag: "span",
ContentTag: "p",
JSONFeed: [], Expand: function(el, opinion)
{
if (opinion.length > 50)
{
var $dv = document.createElement("div");
$($dv).css({
'width': '300px',
'height': '100px',
'position': 'absolute',
'background': '#000',
'font-size': '12px',
'top': '-30px',
'left': '-18px',
'display': 'none',
'box-shadow': '0 0 3px #000',
'opacity': '0.9',
'filter': 'alpha(opacity=90)',
'border-radius': '5px',
'padding': '10px'
});
$($dv).html("" + opinion + "");
$(el).parent().append($dv);
$($dv).fadeIn(300);
}
},
Toggle: function()
{
if (_qFeed.Increment < _qFeed.JSONFeed.length)
{
$(_qFeed.ObjectID).fadeOut(1000);
setTimeout(
function(){
try {
$(_qFeed.ObjectID).find(_qFeed.TitleTag).html(
'' + _qFeed.JSONFeed[_qFeed.Increment]['nume'] + ''
);
$(_qFeed.ObjectID).find(_qFeed.ContentTag).html(
'' + _qFeed.JSONFeed[_qFeed.Increment]['opinion'].substring(0, 55) + ((_qFeed.JSONFeed[_qFeed.Increment]['opinion'].length > 50) ? '...' : '') + ''
);
_qFeed.Increment++;
}
catch (exception) { }},1000);
$(_qFeed.ObjectID).fadeIn(1000);
}
else
{
_qFeed.Increment = 0;
}
},
Stop: function()
{
$(_qFeed.ObjectID).stop();
$(_qFeed.ObjectID).css("opacity","1");
$(_qFeed.ObjectID).css("filter","alpha(opacity=100)");
clearInterval(_qFeed.IntervalHandler);
},
Start: function()
{
_qFeed.Toggle();
clearInterval(_qFeed.IntervalHandler);
_qFeed.IntervalHandler = setInterval(
function(){
_qFeed.Toggle();
}, _qFeed.Transition);
}
};
$(".slides_container").fadeIn(500);
$(".menuhome").hover(
function(){
$(this).attr("src","graphics/menu_home_item_hover.png")
},
function(){
$(this).attr("src","graphics/menu_home_item.png");
}
)
$(".menuhome").mousedown(function(){
$(this).css("top", "1px");
});
$(".menuhome").mouseup(function(){
$(this).css("top", "0px");
});
$(".prev, .next").mousedown(function()
{
$(this).css("top", "-109px");
});
$(".prev, .next").mouseup(function()
{
$(this).css("top", "-110px");
});
$(".menuitem").mousedown(function(){
$(this).css("top", "1px");
});
$(".menuitem").mouseup(function(){
$(this).css("top", "0px");
});
$(document).ready(function(){
$("#contentholder").fadeIn("slow");
$("#logo").click(function(){});
$("#loader").fadeOut(500);
$("#quotes").mouseenter(function(){_qFeed.Stop();});
$("#quotes").mouseleave(function(){_qFeed.Start();});
$('#slides').slides({
preload: true,
preloadImage: '',
effect: 'slide',
play: 2500,
pause: 2500,
hoverPause: true
});
_qFeed.Start();
$(function() {
// Get all textareas that have a "maxlength" property.
$('textarea[maxlength]').each(function() {
// Store the jQuery object to be more efficient...
var $textarea = $(this);
// Store the maxlength and value of the field.
var maxlength = $textarea.attr('maxlength');
var val = $textarea.val();
// Trim the field if it has content over the maxlength.
$textarea.val(val.slice(0, maxlength));
// Bind the trimming behavior to the "keyup" event.
$textarea.bind('keyup', function() {
$textarea.val($textarea.val.slice(0, maxlength));
});
});
});
});