function _(sId){return document.getElementById(sId);}

function showHide(el,show,dispStyle)
{
	if (!dispStyle) dispStyle = 'block';
	var _e = _(el);
	if (show)
		_e.style.display=dispStyle;
	else
		_e.style.display='none';
}
function togggle(el)
{
	var _e = document.getElementById(el);
	if(_e.style.display=='' || _e.style.display=='none')
		_e.style.display='block';
	else
		_e.style.display='none';
}
function showImg(path, title, winName)
{
	window.open('showImg.htm?i='+encodeURIComponent(path)+'&title='+encodeURIComponent(title),winName,'toolbar=no,status=yes,location=no,menubar=no,width=200,height=100,left=150,top=50');
}
function showImgGl(path,title,descr,winName)
{
	window.open('showImgGl.htm?i='+encodeURIComponent(path)+'&amp;title='+encodeURIComponent(title)+'&amp;descr='+encodeURIComponent(descr),winName,'resizable=yes,toolbar=no,status=yes,location=no,menubar=no,width=200,height=100,left=150,top=0');
}

// -----------------------------------------------------------------------------

function fReq(virgullu)
{
	var names = virgullu.split(",");
	var elArr;
	var el;
	for (i=0;i<names.length;i++) {
		elArr = document.getElementsByName(names[i]);
		el = elArr[0];
		var ck=true;
		if (el.type=='radio') {
			ck = false;
			for (j=0;j<elArr.length;j++)
				if (elArr[j].checked) ck = true;
		}
		if (el.value=='' || !ck) {
			alert(YZ_LANG['FREQ1']+el.title+YZ_LANG['FREQ2']);
			el.focus();
			return false;
		}
	}
	return true;
}

// -----------------------------------------------------------------------------

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// -----------------------------------------------------------------------------

/**
* Simple Tabs for Protoculous (Prototype 1.6 + Scriptaculous 1.8)
* halil.ozgur [|at|] gmail.com 2010
*/
var SimpleTabs = Class.create({
	initialize: function(hOpts) {
		this.opts = hOpts;
		this.headElems = $$(this.opts.sHeadSel);
		this.numElems = this.headElems.size();
		this.pos = -1;
		this.opts.sEvent = (this.opts.sEvent ? this.opts.sEvent : 'click');
		if (this.opts.preventClick && this.opts.sEvent != 'click') {
			this.headElems.each(function(s){
				Event.observe(s, 'click', function(event){
					Event.stop(event);
				});
			});
		}
		this.headElems.each(function(s, i){
			Event.observe(s, this.opts.sEvent, function(event){
				this.action(i);
				if (this.opts.preventClick && this.opts.sEvent == 'click') {
					Event.stop(event);
				}
			}.bind(this));
		}.bind(this));
		this.action(0);
		if (this.opts.autoPlay && this.numElems > 1) {
			this.mOver = false;
			if(this.opts.bPauseOnMover) {
				$$(this.opts.sHeadSel+', '+this.opts.sContSel).each(function(s) {
					Event.observe(s, 'mouseover', function(){
						this.mOver = true;
					}.bind(this));
					Event.observe(s, 'mouseout', function(){
						this.mOver = false;
					}.bind(this));
				}.bind(this));
			}
			new PeriodicalExecuter(
				function(){
					if (!this.mOver) {
						this.action(this.pos+1);
					}
				}.bind(this)
			, this.opts.fInterval);
		}
		
	}, // end initialize
	
	action: function(pos) {
		if (pos == this.pos) {
			return;
		}
		if (pos >= 0 && pos < this.numElems) {
			this.pos = pos;
		} else {
			this.pos = 0;
		}
		this.headElems.invoke('removeClassName', this.opts.sActClassName);		
		this.headElems[this.pos].addClassName(this.opts.sActClassName);
		$$(this.opts.sContSel).invoke('hide').invoke('removeClassName', this.opts.sActClassName);
		this.opts.sContSel.split(',').invoke('strip').each(function(s){
			if (this.opts.fnEffectFn) {
				this.opts.fnEffectFn($$(s)[this.pos], (this.opts.sEffectFnArgs ? this.opts.sEffectFnArgs : {}));
			} else {
				$$(s)[this.pos].show();
			}
			$$(s)[this.pos].addClassName(this.opts.sActClassName);
		}.bind(this));
	} // end action
});

// -----------------------------------------------------------------------------

function ubResYukle(id)
{
	var curId = null;
	$$('.ubResUst a').each(function(s){
		if (s.visible()) {
			var sid = s.identify();
			curId = sid.substring(sid.lastIndexOf('_')+1, sid.length);
		}
		if (curId != id) {
			s.hide();
		}
	});
	if (curId != id) {
		//new Effect.Appear($('ubResA_'+id), {duration:0.5});
		$('ubResA_'+id).show();
	}
}

// -----------------------------------------------------------------------------

// Event.simulate
(function(){
  
  var eventMatchers = {
    'HTMLEvents': /^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,
    'MouseEvents': /^(?:click|mouse(?:down|up|over|move|out))$/
  }
  var defaultOptions = {
    pointerX: 0,
    pointerY: 0,
    button: 0,
    ctrlKey: false,
    altKey: false,
    shiftKey: false,
    metaKey: false,
    bubbles: true,
    cancelable: true
  }
  
  Event.simulate = function(element, eventName) {
    var options = Object.extend(defaultOptions, arguments[2] || { });
    var oEvent, eventType = null;
    
    element = $(element);
    
    for (var name in eventMatchers) {
      if (eventMatchers[name].test(eventName)) { eventType = name; break; }
    }
 
    if (!eventType)
      throw new SyntaxError('Only HTMLEvents and MouseEvents interfaces are supported');
 
    if (document.createEvent) {
      oEvent = document.createEvent(eventType);
      if (eventType == 'HTMLEvents') {
        oEvent.initEvent(eventName, options.bubbles, options.cancelable);
      }
      else {
        oEvent.initMouseEvent(eventName, options.bubbles, options.cancelable, document.defaultView,
          options.button, options.pointerX, options.pointerY, options.pointerX, options.pointerY,
          options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, options.button, element);
      }
      element.dispatchEvent(oEvent);
    }
    else {
      options.clientX = options.pointerX;
      options.clientY = options.pointerY;
      oEvent = Object.extend(document.createEventObject(), options);
      element.fireEvent('on' + eventName, oEvent);
    }
    return element;
  }
  
  Element.addMethods({ simulate: Event.simulate });
})()
