
function urlencode(str) {
	return escape(str).replace('+', '%2B').replace('%20', '+').replace('*', '%2A').replace('/', '%2F').replace('@', '%40');
}

function recordOutboundLink(param_this, param_category, param_action) {
  try {
	pageTracker._trackEvent(param_category, param_action);
	setTimeout('document.location = "' + param_this.href + '"', 100)
  }catch(err){}
}

function changeText()
{
 L = document.getElementById( 'author_info_hidden' )
 L.style.display = 'none'
 L = document.getElementById( 'author_info' )
 L.style.display = 'block'
}
function confirmNominate( sURL, nImageID )
{
	if( confirm('Моля маркирайте само конструктивните и полезни от фотографска гледна точка коментари. Коментарът трябва да съдържа обоснован анализ или критика. Не се толерира маркирането на коментари, които съдържат само препинателни знаци, едносрични, хвалебствени и други подобни. При злоупотреба с този бутон, снимката Ви ще бъде изтрита от администратора!') )
	{
		window.open( sURL,'name_' + nImageID,'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=250,height=250')
	}
}
function ImageVote( sURL, Vote )
{
	window.open( sURL+Vote,'cookie_test_window','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=250,height=250')
}
function ImageVoteAdmin( sURL, Vote )
{
	window.open(sURL+Vote,'cookie_test_window','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=250,height=250')
}

function translit(elemID) {
	var str = elemID.value; 
	str = str.replace(/sht/gi,'щ');
	str = str.replace(/ija/gi,'ия');
	str = str.replace(/zge$/gi,'же');
	str = str.replace(/lyo/gi,'льо');
	str = str.replace(/tz/gi,'ц');
	str = str.replace(/yo/gi,'йо');
	str = str.replace(/sh/gi,'ш');
	str = str.replace(/ux$/gi,'укс');
	str = str.replace(/zh/gi,'ж');
	str = str.replace(/iu/gi,'ю');
	str = str.replace(/ju/gi,'ю');
	str = str.replace(/ja/gi,'я');
	str = str.replace(/ya/gi,'я');
	str = str.replace(/ia/gi,'я');
	str = str.replace(/tc/gi,'ц');
	str = str.replace(/ts/gi,'ц');
	str = str.replace(/ch/gi,'ч');
	str = str.replace(/lq/gi,'ля');
	str = str.replace(/ck/gi,'к');
	str = str.replace(/6t/gi,'щ');
	str = str.replace(/(\w)4/gi,"$1ч");
	str = str.replace(/4(\w)/gi,"ч$1");
	str = str.replace(/(\w)3/gi,"$1з");
	str = str.replace(/3(\w)/gi,"з$1");
	str = str.replace(/(\w)6/gi,"$1ш");
	str = str.replace(/6(\w)/gi,"ш$1");
	str = str.replace(/`/gi,'ч');
	str = str.replace(/\]/gi,'щ');
	str = str.replace(/\[/gi,'ш');
	str = str.replace(/a/gi,'а');
	str = str.replace(/b/gi,'б');
	str = str.replace(/c/gi,'ц');
	str = str.replace(/d/gi,'д');
	str = str.replace(/e/gi,'е');
	str = str.replace(/f/gi,'ф');
	str = str.replace(/g/gi,'г');
	str = str.replace(/h/gi,'х');
	str = str.replace(/i/gi,'и');
	str = str.replace(/j/gi,'ж');
	str = str.replace(/k/gi,'к');
	str = str.replace(/l/gi,'л');
	str = str.replace(/m/gi,'м');
	str = str.replace(/n/gi,'н');
	str = str.replace(/o/gi,'о');
	str = str.replace(/p/gi,'п');
	str = str.replace(/q/gi,'я');
	str = str.replace(/r/gi,'р');
	str = str.replace(/s/gi,'с');
	str = str.replace(/t/gi,'т');
	str = str.replace(/u/gi,'у');
	str = str.replace(/v/gi,'в');
	str = str.replace(/w/gi,'в');
	str = str.replace(/x/gi,'х');
	str = str.replace(/y/gi,'ъ');
	str = str.replace(/z/gi,'з');    
	
	elemID.value = str; 
}

function setBackground(color){
	document.getElementById("tblMainPic").style.background = color;
}

function fullscreenWindow(url) {
	var winwidth = screen.availWidth;
	var winheight = screen.availHeight;
	if (document.all) {
		var sizer = window.open("","",'left=0,top=0,width='+winwidth+',height='+winheight+',scrollbars=yes,fullscreen=yes');
		sizer.location = url;
	} else {
		window.open(url,'fotowindow','width=winwidth,height=winheight,menubar=no,status=no,location=no,scrollbars=yes,fullscreen=yes,directories=no,resizable=yes');
	}
}



/*
 * jqModal - Minimalist Modaling with jQuery
 *   (http://dev.iceburg.net/jquery/jqModal/)
 *
 * Copyright (c) 2007,2008 Brice Burgess <bhb@iceburg.net>
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 * 
 * $Version: 03/01/2009 +r14
 */
(function($) {
$.fn.jqm=function(o){
var p={
overlay: 50,
overlayClass: 'jqmOverlay',
closeClass: 'jqmClose',
trigger: '.jqModal',
ajax: F,
ajaxText: '',
target: F,
modal: F,
toTop: F,
onShow: F,
onHide: F,
onLoad: F
};
return this.each(function(){if(this._jqm)return H[this._jqm].c=$.extend({},H[this._jqm].c,o);s++;this._jqm=s;
H[s]={c:$.extend(p,$.jqm.params,o),a:F,w:$(this).addClass('jqmID'+s),s:s};
if(p.trigger)$(this).jqmAddTrigger(p.trigger);
});};

$.fn.jqmAddClose=function(e){return hs(this,e,'jqmHide');};
$.fn.jqmAddTrigger=function(e){return hs(this,e,'jqmShow');};
$.fn.jqmShow=function(t){return this.each(function(){t=t||window.event;$.jqm.open(this._jqm,t);});};
$.fn.jqmHide=function(t){return this.each(function(){t=t||window.event;$.jqm.close(this._jqm,t)});};

$.jqm = {
hash:{},
open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(parseInt(h.w.css('z-index'))),z=(z>0)?z:3000,o=$('<div></div>').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});if(h.a)return F;h.t=t;h.a=true;h.w.css('z-index',z);
 if(c.modal) {if(!A[0])L('bind');A.push(s);}
 else if(c.overlay > 0)h.w.jqmAddClose(o);
 else o=F;

 h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):F;
 if(ie6){$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in {Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}}

 if(c.ajax) {var r=c.target||h.w,u=c.ajax,r=(typeof r == 'string')?$(r,h.w):$(r),u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u;
  r.html(c.ajaxText).load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});}
 else if(cc)h.w.jqmAddClose($(cc,h.w));

 if(c.toTop&&h.o)h.w.before('<span id="jqmP'+h.w[0]._jqm+'"></span>').insertAfter(h.o);	
 (c.onShow)?c.onShow(h):h.w.show();e(h);return F;
},
close:function(s){var h=H[s];if(!h.a)return F;h.a=F;
 if(A[0]){A.pop();if(!A[0])L('unbind');}
 if(h.c.toTop&&h.o)$('#jqmP'+h.w[0]._jqm).after(h.w).remove();
 if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return F;
},
params:{}};
var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&($.browser.version == "6.0"),F=false,
i=$('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0}),
e=function(h){if(ie6)if(h.o)h.o.html('<p style="width:100%;height:100%"/>').prepend(i);else if(!$('iframe.jqm',h.w)[0])h.w.prepend(i); f(h);},
f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(_){}},
L=function(t){$()[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);},
m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return !r;},
hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function() {
 if(!this[c]){this[c]=[];$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return F;});}this[c].push(s);});});};
})(jQuery);

