
var mstatus = 0;
var pausecontent2=new Array()

function flags(){$("#DivAjax").html("<img src='../smimages/flags/"+$("#inflag").val()+".gif' alt='' />")}
function gto(A){window.location=A}function popUp(A){props=window.open(A,"poppage","toolbars=0, scrollbars=1, location=0, statusbars=0, menubars=0, resizable=1, width=600, height=400, left = 300, top = 150");return false;}function pprint(){this.window.print();}
function confi(A){return confirm(A)}function changeact(C,B){var A=document.getElementById(C);A.action=B;A.submit()}
function changeactconf(C,B,D){if(!confirm(D)){return false}var A=document.getElementById(C);A.action=B;A.submit()}
function loadBar(){$("#ajbar").load("index.php?act=bar")}
function tipon(x){	$("#tipbox").slideDown("normal",function(){$("#tipbox").html("<div><b>"+x[0]+"</b><br /><span>"+x[1]+"</span></div>")});	}
function tipoff(){	$("#tipbox").slideUp("normal",function(){$("#tipbox").html("")});	}	
function checkpress(a,b,c,d,e){
	var errors=0;
	var msg  = "______________________________________________________\n\n"
	if(e != 1){if($("#press_piconoff").is(':checked'))	{if($("#press_pic").val() == ""){errors +=1;msg += a+"\n";}}}
	if($("#press_sec").val() == ""){errors +=1;msg += b+"\n";}
	if($("#press_title").val() == ""){errors +=1;msg += c+"\n";}
	if($("#press_press").val() == ""){errors +=1;msg += d+"\n";}
	msg  += "______________________________________________________\n\n"
	if(errors != 0){alert(msg);return false;}else{return true;}
}
function sendajaxform(fname,action,t,di,meth,da,count,divlayer,imglo){var m="";	var d="";$("#"+di).fadeOut("slow");	if(meth == "post"){m="POST";}else{m="GET";}
		var re = new RegExp('class="suc-msg-square"');
		for(x=0;x<count;x++){d=d+da[x]+"="+$('[name='+da[x]+']').val()+"&";}
		$(divlayer).html('&nbsp;&nbsp;<img src="'+imglo+'" alt="" />&nbsp;&nbsp;');
		
		$.ajax({
			type: m,
			url: ""+action+"",
			data: ""+d+"token="+t,
			success: function(result){
					$(divlayer).html(" ");
					$("#"+di).html(result);
					$("#"+di).fadeIn("slow");
					if(result.match(re))
						{
							for(x=0;x<count;x++){$("#"+da[x]).val("");}
						}
				}
			})
			
		return false; 
	}
	
function refreshcapt(a,imglo){
	$("#captchaimg").attr('src',"index.php?act=captchaimg&id="+a+"&"+Math.random());
}

function sendcomm(fname,action,t,di,meth,da,count,divlayer,imglo,id){var m="";	var d="";$("#"+di).fadeOut("slow");	if(meth == "post"){m="POST";}else{m="GET";}
		var re = new RegExp('class="suc-msg-square"');
		for(x=0;x<count;x++){d=d+da[x]+"="+$('[name='+da[x]+']').val()+"&";}
		$(divlayer).html('&nbsp;&nbsp;<img src="'+imglo+'" alt="" />&nbsp;&nbsp;');
		
		$.ajax({
			type: m,
			url: ""+action+"",
			data: ""+d+"token="+t,
			success: function(result){
					$(divlayer).html(" ");
					$("#"+di).html(result);
					$("#"+di).fadeIn("slow");
					if(result.match(re))
						{
							refreshcapt(id);
							for(x=0;x<count;x++){$("#"+da[x]).val("");}
						}
				}
			})
			
		return false; 
	}
	
function sendpollform(fname,action,t,di,meth,da,count,divlayer,imglo){var m="";	var d="";$("#"+di).fadeOut("slow");	if(meth == "post"){m="POST";}else{m="GET";}
		for(x=0;x<count;x++){d=d+da[x]+"="+$('[name='+da[x]+']').val()+"&";}
		$(divlayer).html('&nbsp;&nbsp;<img src="'+imglo+'" alt="" />&nbsp;&nbsp;');
		
		$.ajax({
			type: m,
			url: ""+action+"",
			data: ""+d+"token="+t,
			success: function(result){
					$(divlayer).html(" ");
					$("#"+di).html(result);
					$("#"+di).fadeIn("slow");
					for(x=0;x<count;x++){$("#"+da[x]).val("");}
				}
			})
			
		return false; 
	}

function rate(action,t,di,meth,da,count,divlayer,imglo)
	{
		var m="";
		var d="";
		$("#"+di).fadeOut("slow");
		if(meth == "post"){m="POST";}else{m="GET";}
		d="rate="+$("#"+da).val()+"&";
		$(divlayer).html('&nbsp;&nbsp;<img src="'+imglo+'" alt="" />&nbsp;&nbsp;');
		
		$.ajax({
			type: m,
			url: ""+action+"",
			data: ""+d+"token="+t,
			success: function(result){
					$(divlayer).html(" ");
					$("#"+di).html(result);
					$("#"+di).fadeIn("slow");
					$("#m1").slideUp("normal");
					$("#m1").css("display","none");
					mstatus=0;
				}
			})
			
		return false; 
	}
	
function poll(action,t,di,meth,da,confmsg,divlayer,imglo)
	{
		if(confirm(confmsg))
			{
				var m="";
				var d="";
				$("#"+di).fadeOut("slow");
				if(meth == "post"){m="POST";}else{m="GET";}
				d="opt="+$("#"+da).val()+"&";
				$(divlayer).html('&nbsp;&nbsp;<img src="'+imglo+'" alt="" />&nbsp;&nbsp;');
				$.ajax({
					type: m,
					url: ""+action+"",
					data: ""+d+"token="+t,
					success: function(result){
							$(divlayer).html(" ");
							$("#"+di).html(result);
							$("#"+di).fadeIn("slow");
							$("#m1").slideUp("normal");
							$("#m1").css("display","none");
							mstatus=0;
						}
					})
			}
			
		return false; 
	}
	
function jqueryst()
	{$(document).ready(function(){
			$(".tab-box").hover(function(){$(this).addClass("trcss");},function(){$(this).removeClass("trcss")});
			$("#checkall").click(function(){$("input:checkbox").attr("checked",true);$("tr").addClass("trcssch");$("#defaulttr").removeClass("trcssch")});$("#uncheckall").click(function(){$("input:checkbox").attr("checked",false);$("tr").removeClass("trcssch")});$(":checkbox").click(function(){if($(this).attr("checked")==true){$(this).parents("tr").addClass("trcssch")}else{$(this).parents("tr").removeClass("trcssch")}});
			$("#inflag").each(function(){$("#DivAjax").html("<img src='../smimages/flags/"+$("#inflag").val()+".gif' alt='' />")});
			$("textarea").focus(function(){$(this).addClass("input-focus");$(this).fadeTo('fast',0.5);$(this).fadeTo('fast',1.0)});
			$("textarea").blur(function(){$(this).removeClass("input-focus")});
			$("input.text").focus(function(){$(this).addClass("input-focus")});
			$("input.text").blur(function(){$(this).removeClass("input-focus")});
			$("input.rach").focus(function(){$(this).addClass("input-focus");$(this).fadeTo('fast',0.5);$(this).fadeTo('fast',1.0);});
			$("input.rach").blur(function(){$(this).removeClass("input-focus")});
			$("input.button").click(function(){$(this).addClass("buttondis");});
			$("textarea#cocomment").focus(function(){$("#hint").css("display","block")});
			$("textarea#cocomment").blur(function(){$("#hint").css("display","none")});
		})
	};
	
function intwindow(winid,winclass,imgloader,auto_hide,positionid,url,img){
	$("#"+winclass).html('<div style="text-align: center"><img src="'+imgloader+'" alt="" /></div>');
	if(img == 1)
		{
			$("#"+winclass).html("<img src='"+url+"' alt='' />")
		}
	else
		{
			$("#"+winclass).load(""+url+"")
			
		}
			
	$("#"+winid).css("display","block");		
}

function close_window(winid,winclass){
	$("#"+winid).css("display","none");
	$("."+winclass).html("");
}

function leftdir(x){
	$(x).attr("direction","left");
}

function rightdir(x){
	$(x).attr("direction","right");
}

function mopen(m)
	{
		if(mstatus==1)
			{
				
				$("#"+m).slideUp("normal");
				$("#"+m).css("display","none");
				mstatus=0;
			}
		else
			{
				
				$("#"+m).slideDown("normal");
				$("#"+m).css("display","block");
				mstatus=1;
			}
	}
	
function pausescroller(content, divId, divClass, delay){
this.content=content //message array content
this.tickerid=divId //ID of ticker div to display information
this.delay=delay //Delay between msg change, in miliseconds.
this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over scroller (and pause it if it is)
this.hiddendivpointer=1 //index of message array for hidden div
document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden"><div class="innerDiv" style="position: absolute; width: 100%" id="'+divId+'1">'+content[0]+'</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="'+divId+'2">'+content[1]+'</div></div>')
var scrollerinstance=this
if (window.addEventListener) //run onload in DOM2 browsers
window.addEventListener("load", function(){scrollerinstance.initialize()}, false)
else if (window.attachEvent) //run onload in IE5.5+
window.attachEvent("onload", function(){scrollerinstance.initialize()})
else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec
setTimeout(function(){scrollerinstance.initialize()}, 500)
}

pausescroller.prototype.initialize=function(){
this.tickerdiv=document.getElementById(this.tickerid)
this.visiblediv=document.getElementById(this.tickerid+"1")
this.hiddendiv=document.getElementById(this.tickerid+"2")
this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv))
//set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2)
this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px"
this.getinline(this.visiblediv, this.hiddendiv)
this.hiddendiv.style.visibility="visible"
var scrollerinstance=this
document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0}
if (window.attachEvent) //Clean up loose references in IE
window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null})
setTimeout(function(){scrollerinstance.animateup()}, this.delay)
}

pausescroller.prototype.animateup=function(){
var scrollerinstance=this
if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop+5)){
this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+"px"
this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+"px"
setTimeout(function(){scrollerinstance.animateup()}, 50)
}
else{
this.getinline(this.hiddendiv, this.visiblediv)
this.swapdivs()
setTimeout(function(){scrollerinstance.setmessage()}, this.delay)
}
}

pausescroller.prototype.swapdivs=function(){
var tempcontainer=this.visiblediv
this.visiblediv=this.hiddendiv
this.hiddendiv=tempcontainer
}

pausescroller.prototype.getinline=function(div1, div2){
div1.style.top=this.visibledivtop+"px"
div2.style.top=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px"
}

pausescroller.prototype.setmessage=function(){
var scrollerinstance=this
if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it)
setTimeout(function(){scrollerinstance.setmessage()}, 100)
else{
var i=this.hiddendivpointer
var ceiling=this.content.length
this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1
this.hiddendiv.innerHTML=this.content[this.hiddendivpointer]
this.animateup()
}
}

pausescroller.getCSSpadding=function(tickerobj){ //get CSS padding value, if any
if (tickerobj.currentStyle)
return tickerobj.currentStyle["paddingTop"]
else if (window.getComputedStyle) //if DOM2
return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top")
else
return 0
}
