//window.onerror=function(){return true;}

function bg(name,arg){
name.style.backgroundColor=arg;
}

function view_img(id,alt){
var viewimg=window.open('view_img.php?id='+id+'&alt='+escape(alt),'','width=100,height=100');
}

function open_request(id){
var openrequest=window.open('open_request.php?id='+id,'','width=700,height=600,scrollbars=1');
}

function open_preview(id){
var openpreview=window.open('open_preview.php?id='+id,'','width=600,height=500');
}

function objectXY(obj) {
var dobj=eval('document.getElementById("'+obj+'")')
   var x = 0, y = 0;
do{
    x += dobj.offsetLeft;
    y += dobj.offsetTop;
  }while (typeof(dobj = dobj.offsetParent) != 'undefined' && dobj != null);
   return [x,y];
}

function set_webmoney_label(){
var pos=objectXY('marker_bottom');
lay=document.getElementById('WebMoney_Label').style;
lay.left=pos[0];
lay.top=pos[1]-60;
lay.visibility='visible';
}


function win_resize(e,intWidth,intHeight){
  var newW=(intWidth==null || intWidth=='' || isNaN(parseInt(intWidth)))? 800 : parseInt(intWidth);
  var newH=(intHeight==null || intHeight=='' || isNaN(parseInt(intHeight)))? 800 : parseInt(intHeight);
  if(is_ie4 || is_ie){newW+=10;newH+=29;}
  if(is_ns4 || is_ns){newW+=6;newH+=27;}
  if(is_opera){newW+=10;newH+=29;}
  if(is_firefox){newW+=0;newH+=22;}
	if(screen.width>newW)newLeft=Math.round((screen.width-newW)/2);
	 else newLeft=10;
	if(screen.height>newH)newTop=Math.round((screen.height-newH)/2);
	 else newTop=10;
  e.resizeTo(newW,newH);
  e.moveTo(newLeft,newTop);
}

var userAgent = navigator.userAgent.toLowerCase();
var is_opera  = (userAgent.indexOf('opera') != -1);
var is_firefox  = (userAgent.indexOf('firefox') != -1);
var is_saf    = ((userAgent.indexOf('applewebkit') != -1) || (navigator.vendor == 'Apple Computer, Inc.'));
var is_webtv  = (userAgent.indexOf('webtv') != -1);
var is_ie     = ((userAgent.indexOf('msie') != -1) && (!is_opera) && (!is_saf) && (!is_webtv));
var is_ie4    = ((is_ie) && (userAgent.indexOf('msie 4.') != -1));
var is_moz    = ((navigator.product == 'Gecko') && (!is_saf));
var is_kon    = (userAgent.indexOf('konqueror') != -1);
var is_ns     = ((userAgent.indexOf('compatible') == -1) && (userAgent.indexOf('mozilla') != -1) && (!is_opera) && (!is_webtv) && (!is_saf));
var is_ns4    = ((is_ns) && (parseInt(navigator.appVersion) == 4));
var is_mac    = (userAgent.indexOf('mac') != -1);

function move_window_to_center_screen(){
if(is_ns4 || is_ns){
leftco=document.body.offsetWidth+16;
topco=document.body.offsetHeight+44;
}
if(is_ie || is_ie4 || is_firefox){
leftco=document.body.clientWidth;
topco=document.body.clientHeight;
}
if(is_opera){
leftco=document.body.clientWidth;
topco=document.body.clientHeight+200;
}
newLeft=Math.round((screen.width-leftco)/2);
newTop=Math.round((screen.height-topco)/2);

window.moveTo(newLeft,newTop);
}



function blur_inp(name){
	if(name.value=='')bg(name,'');
}



		var scrollovers_TypeName = 'scrollover';
		var scrollovers_StartScrollLocation = 0;
		var scrollovers_EndScrollLocationTrim = 0;
		var scrollovers_ScrollSpeed = 3;
		var scrollovers_ScrollDownOnMouseOver = true;

		
		var scrollovers_ElementsInFocus = new Array();
		
		function scrollovers_Init(){
			/* DEFAULT TRIM SETTINGS */
			scrollovers_StartScrollLocation = 0;
			scrollovers_EndScrollLocationTrim = -1;
			
			if(navigator.userAgent.toLowerCase().indexOf("safari")!=-1){
				/* SAFARI TRIM SETTINGS */
				scrollovers_StartScrollLocation = 0;
				scrollovers_EndScrollLocationTrim = -1;
			}else if(navigator.userAgent.toLowerCase().indexOf("opera")!=-1){
				/* OPERA TRIM SETTINGS */				
				scrollovers_StartScrollLocation = 0;
				scrollovers_EndScrollLocationTrim = -1;
			}
			
			var aTmp = document.getElementsByTagName('a');
			var aLinks = new Array();
			for(i=0;i<aTmp.length;i++){
				if(scrollovers_TypeName == '' || aTmp[i].getAttribute('type') == scrollovers_TypeName){
					aLinks.push(aTmp[i]);
				}
			}
			aTmp = null;
		
			for(i=0;i<aLinks.length;i++){
				var sElemId = 'scrollover_'+i;
				var sExistingHTML = aLinks[i].innerHTML;
				var iWidth = parseInt(aLinks[i].scrollWidth)+1;
				var sHtml = '';
//				aLinks[i].style.textDecoration = 'none';
				
				sHtml += 	'<span style="display:block; cursor:pointer; cursor:hand; height:1em; position:relative; overflow:visible; width:'+iWidth+'px; margin-top:-0.2em;">';
				sHtml +=		'<span style="display:block; position:absolute; overflow:hidden; height:1.3em; width:'+iWidth+'px; margin-bottom:-0.3em;">';
				sHtml +=			'<span style="display:block; margin-top:-0.1em; position:absolute; width:'+iWidth+'px;" class="scrollover_Nudge">';
				sHtml +=				'<em id="'+sElemId+'" style="display:block; line-height:1.4em; position:absolute; top:'+scrollovers_StartScrollLocation+'px; font-style:normal;">'+sExistingHTML+' '+sExistingHTML+'</em>';
				sHtml +=			'</span>';
				sHtml +=		'</span>';
				sHtml +=	'</span>';

				var sOriginalText = aLinks[i].innerText;
				aLinks[i].innerHTML = '';
				var oScrollover = document.createElement('fieldset');
				oScrollover.style.border = 'none';
				oScrollover.style.lineHeight = '1em';
				oScrollover.style.width = iWidth;
				oScrollover.style.textAlign = 'left';
				oScrollover.style.display = 'inline';
				oScrollover.style.margin = '0';
				oScrollover.style.padding = '0';
				oScrollover.innerHTML = sHtml;
				
				aLinks[i].appendChild(oScrollover);

				var oTag = document.getElementById(sElemId);
				
				var oElement = new Element(sElemId, oTag);
				scrollovers_ElementsInFocus.push(oElement);
				oTag.elementObject = oElement;
				oTag.onmouseover = scrollovers_MouseOver;
				oTag.onmouseout = scrollovers_MouseOut;
				
				if(scrollovers_ScrollDownOnMouseOver){
					oTag.style.top = (oElement.ScrollHeight*-1)+scrollovers_EndScrollLocationTrim+'px';
				}
			}
		}
		function scrollovers_MouseOver(oEvent){
			var oSender = null;
			if(window.event){
				oSender = window.event.srcElement;
			}else{
				oSender = oEvent.target;
			}

			scrollovers_ElementsInFocus.getById(oSender.elementObject.Id).MouseIsOver = true;
			if(scrollovers_ScrollDownOnMouseOver){
				setTimeout('scrollovers_RollDown(\''+oSender.elementObject.Id+'\')', 100);
			}else{
				setTimeout('scrollovers_RollUp(\''+oSender.elementObject.Id+'\')', 100);
			}
		}
		function scrollovers_MouseOut(oEvent){
			var oSender = null;
			if(window.event){
				oSender = window.event.srcElement;
			}else{
				oSender = oEvent.target;
			}
			oSender.elementObject.MouseIsOver = false;
			if(scrollovers_ScrollDownOnMouseOver){
				setTimeout('scrollovers_RollUp(\''+oSender.elementObject.Id+'\')', 100);
			}else{
				setTimeout('scrollovers_RollDown(\''+oSender.elementObject.Id+'\')', 100);
			}
		}
		function scrollovers_RollUp(sIdToRoll){
			var oElementToRoll = scrollovers_ElementsInFocus.getById(sIdToRoll);
			if(scrollovers_ScrollDownOnMouseOver){
				if(oElementToRoll.MouseIsOver){return;}
			}else{
				if(!oElementToRoll.MouseIsOver){return;}
			}
			if(oElementToRoll.ScrollLocation+scrollovers_ScrollSpeed < oElementToRoll.ScrollHeight){
				oElementToRoll.ScrollLocation += scrollovers_ScrollSpeed;
				oElementToRoll.TagRef.style.top = oElementToRoll.ScrollLocation*-1+'px';
				setTimeout('scrollovers_RollUp(\''+sIdToRoll+'\')', 10);
			}else{
				oElementToRoll.ScrollLocation =  oElementToRoll.ScrollHeight;
				oElementToRoll.TagRef.style.top = (oElementToRoll.ScrollHeight*-1)+scrollovers_EndScrollLocationTrim+'px';
			}
		}
		function scrollovers_RollDown(sIdToRoll){
			var oElementToRoll = scrollovers_ElementsInFocus.getById(sIdToRoll);
			if(scrollovers_ScrollDownOnMouseOver){
				if(!oElementToRoll.MouseIsOver){return;}
			}else{
				if(oElementToRoll.MouseIsOver){return;}
			}
			if(oElementToRoll.ScrollLocation-scrollovers_ScrollSpeed > scrollovers_StartScrollLocation){
				oElementToRoll.ScrollLocation -= scrollovers_ScrollSpeed;
				oElementToRoll.TagRef.style.top = oElementToRoll.ScrollLocation*-1+'px';
				setTimeout('scrollovers_RollDown(\''+sIdToRoll+'\')', 10);
			}else{
				oElementToRoll.ScrollLocation =  scrollovers_StartScrollLocation;
				oElementToRoll.TagRef.style.top = scrollovers_StartScrollLocation+'px';
			}
		}
		
		function Element(sId, oObject){
			this.Id = sId;
			this.TagRef = oObject;
			this.ScrollHeight = parseInt(this.TagRef.scrollHeight)/2-1;
			this.ScrollLocation = (scrollovers_ScrollDownOnMouseOver?this.ScrollHeight:0);
			this.MouseIsOver = false;
		}
		Array.prototype.getById = function(sId){
										for(i=0;i<this.length;i++){
											if(this[i].Id == sId){
												return this[i];
											}
										}
										return null;
								  }; 
		Array.prototype.getIndexById = function(sId){
										for(i=0;i<this.length;i++){
											if(this[i].Id == sId){
												return i;
											}
										}
										return null;
								  }; 

window.onload=function(){
scrollovers_Init();
if(typeof set_webmoney_label !='undefined' && typeof marker_bottom !='undefined')set_webmoney_label();
}
