var shi = new Array();
sh = function(id, t, n){this.init(id, t, n);};
$.extend(sh.prototype, {
	init: function(id, t, n) {
		this.id = id;
		shi[this.id.substr(3)] = this;
		this.t = t;
		this.m = '#'+this.id;
		$(this.m).css({position: 'relative', overflow: 'hidden'});
		this.h = $(this.m).height();
		$(this.m+'>li').css({position: 'absolute', top: this.h, left:0, width:$(this.m).width()})

		this.c = $(this.m+'>li').size();
		this.n = n%this.c;
		this.o = this.n;
		$(this.m+'>li:eq('+this.n+')').css('top','0px');
		if(this.c>1)this.s();
	},
	s: function() {
		var ix=this.id.substr(3);
		this.i = setInterval(function(){shi[ix].r(shi[ix])},this.t);
		$(this.m).hover(function() {clearInterval(shi[this.id.substr(3)].i);}, function() {var ix=this.id.substr(3);
			shi[ix].i = setInterval(function(){shi[ix].r(shi[ix])},shi[ix].t);
			});
	},
	r: function(obj) {
		obj.n = (obj.o + 1) % obj.c; 
		$(obj.m+'>li:eq(' + obj.o + ')').animate({top: -obj.h-10},"slow", function() {
			$(this).css('top',obj.h);
		});
		$(obj.m+'>li:eq(' + obj.n + ')').show().animate({top: 0},"slow");  
		obj.o = obj.n;
	}
});
function updateBookmarks(){
	$('a[href*=#]').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
			var $target = $(this.hash);
			if(this.hash=='#top'){
				$('html,body').animate({scrollTop: 0}, 700);
				return false;			
			}
			$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
			if ($target.length) {
				var targetOffset = $target.offset().top;
				$('html,body').animate({scrollTop: targetOffset}, 700);
				return false;
			}
		}
	});
}
function popUp(s,page,w,h,sc,rs){
s = document.all?s:0;
if(s){
	return window.showModalDialog(page,null,"dialogHeight:"+h+"px;dialogWidth:"+w+"px;status:no;resizable:"+rs+";scroll:"+sc+";help:no;center:yes")
}else{
	var cW = window.open(page,'OPBYMY'+w+'_'+h,"height="+h+",width="+w+",left=200,top=150,status=no,toolbar=no,menubar=no,location=no,resizable="+rs+",scrollbars="+sc+",directories=no,titlebar=no");
	cW.window.focus();}
}
function printNote(f){
	if ($('#_PRNHDR').is(':hidden')) { 
		$('#_PRNHDR').show('fast', function(){_PRNNOTES.focus();
		f._PRNNOTES.value = 'Attention: ';}); 
      
      } else { 
       $('#_PRNHDR').slideUp(); 
     } 
}
function ch_lg(o){
	if($(o).text()=='En')
		$(o).text('Fa').parent().children(':input').css('direction','rtl').bind('keypress',kb_).focus();
	else
		$(o).text('En').parent().children(':input').css('direction','ltr').unbind('keypress').focus();
}
function l_go(o){
	for (k in o)document.forms.l_f[k].value=o[k];
	document.forms.l_f.submit();
}
function l_pop(o,w){
	var x='';
	$('#l_f input').each(function(k){x+='&'+this.name+'='+(o[this.name]?o[this.name]:this.value)});
	popUp(w['s'],'?'+x.substr(1),w['w'],w['h'],1,0);
//	popUp(0,'?'+x.substr(1),330,480,1,0);
}

