function hideValue(what, def)
{
	if(trim(what.value) == def)
	{
		what.value = "";
	}
	return;
}

function showValue(what, def)
{
	if(trim(what.value) == '')
	{
		what.value = def;
	}
	return;
}

// Removes leading whitespaces
function LTrim( value )
{
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
	
}

// Removes ending whitespaces
function RTrim( value )
{
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
	
}

// Removes leading and ending whitespaces
function trim( value )
{
	return LTrim(RTrim(value));
	
}

function loadImages(path, pics)
{
	pics_arr = pics.split(',');
	for(i=0; i < pics_arr.length; i++)
	{
		eval('c' + i + ' = new Image();');
		eval('c' + i + '.src = path + "' + pics_arr[i] + '";');
	}
}

function changeBgck(what, img)
{
	document.getElementById(what).style.backgroundImage = "url('"+img+"')";
	//document.getElementById(what).style.backgroundPosition = 'middle';
}

function preloadImages(img_array)
{
	pics_array = img_array.split(',');
	for(i = 0; i < pics_array.length; i++)
	{
		eval("c"+i+" = new Image; c"+i+".src = pics_array[i];");
	}
}

var timer_id;
var direction=0;
var curr = 0;
function scroll_iframe(frm,inc,dir)
{
  if (timer_id) clearTimeout(timer_id);
  if (window.frames[frm])
  {
    if (direction == 0)
    {
    	curr += inc;
    	window.frames[frm].scrollBy(0, inc);
    	if(curr >= window.frames[frm].document.body.offsetHeight)
    	{
    		direction = 1;
    		curr = window.frames[frm].document.body.offsetHeight;
    	}
    }
    else if (direction == 1)
    {
    	curr -= inc;
    	window.frames[frm].scrollBy(0, -inc);
    	if(curr <= 0)
    	{
    		direction = 0;
    		curr = 0;
    	}
    }
    //else window.frames[frm].scrollBy(inc, 0);
    timer_id = setTimeout("scroll_iframe('" + frm + "'," + inc + ",'" + dir + "')", 5);
  }
}

function stopScroll()
{
	if (timer_id) clearTimeout(timer_id);
}

function change_class(tid, cfg)
{
	if(cfg == 1) newclass = 'admin_button';
	else if(cfg == 2) newclass = 'admin_button_over';
	
	//var dtarget = document.getElementById(tid);
	
	tid.className = newclass;
}

Array.prototype.in_array = function ( obj )
{
	var len = this.length;
	for ( var x = 0 ; x <= len ; x++ )
	{
		if ( this[x] == obj ) return true;
	}
	return false;
}

function closeBox(eval_script)
{
	if(document.getElementById('showMessage')) 
	{
		document.body.removeChild(document.getElementById('showMessage'));
		document.body.removeChild(document.getElementById('showMessageBox'));
		
		eval(eval_script);
	}
}

function showLightboxAlert(msg, msg_title, eval_script)
{
	var sizes = getPageSize();
	var scrollWidth = getScrollX();
	var scrollHeight = getScrollY();
	var windowWidth = winWidth();
	var windowHeight = winHeight();
	var bodyHeight = getPageSize();
	
	//main div
	dl = document.createElement('div');
	dl.id = 'showMessage';
	dl.style.position = 'absolute';
	dl.style.width = '100%';
	dl.style.height = bodyHeight[1] + 'px';
	dl.style.backgroundColor = '#000000';
	dl.style.top = 0+'px';
	dl.style.left = scrollWidth+'px';
	dl.style.textAlign = 'center';
	dl.style.filter='alpha(opacity=70)';
	dl.style.opacity='.70';
	dl.style.zIndex = 1600;
	
	//msg div
	pl = document.createElement('div');
	pl.id = 'showMessageBox';
	pl.style.width = '300px';
	pl.style.position = 'absolute';
	pl.style.backgroundColor = '#FFFFFF';
	pl.style.top = ((windowHeight/2)+scrollHeight)-100+'px';
	pl.style.left = '50%';
	pl.style.marginLeft = '-150px';
	pl.style.padding = '0px 0px 10px 0px';
	pl.style.textAlign = 'left';
	pl.style.border = '#000000 1px solid';
	pl.style.zIndex = 1605;
	
	//close div
	cl = document.createElement('div');
	cl.id = 'showMessageBoxClose';
	cl.style.backgroundColor = '#FFFFFF';
	cl.style.textAlign = 'left';
	cl.style.padding = '10px 5px 0px 10px';
	cl.innerHTML = '<input type="button" onclick="javascript:closeBox(\'' + eval_script + '\');" class="input-btn" value="Close"/>';
	
	pl.innerHTML = '<div style="float:left;width:290px;background-image:url(\'http://hafsanitaer.com/images/default/haf_nav_bgck.gif\');border-bottom:#000000 1px solid;color:#ffffff;text-align:left;height:20px;padding-left:10px;padding-top:5px;"><b>' + msg_title + '</b></div>';
	pl.innerHTML += '<div style="float:left;width:280px;padding:10px 10px 10px 10px;font-weight:bold;" class="black">' + msg + '</div>';
	pl.appendChild(cl);
	
	document.body.insertBefore(dl, document.body.firstChild);
	document.body.insertBefore(pl, document.body.firstChild);
	
	scroll(0, scrollHeight);
}

function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowW, windowH;
	if (self.innerHeight) {	// all except Explorer
		windowW = self.innerWidth;
		windowH = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowW = document.documentElement.clientWidth;
		windowH = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowW = document.body.clientWidth;
		windowH = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowH){
		pageHeight = windowH;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowW){	
		pageWidth = windowW;
	} else {
		pageWidth = xScroll;
	}
	
	arrayPageSize = new Array(pageWidth,pageHeight,windowW,windowH) 
	return arrayPageSize;
}

function winWidth()
{
  var myWidth = 0;
  if( typeof( window.innerWidth ) == 'number' )
  {
    //Non-IE
    myWidth = window.innerWidth;
  }
  else if( document.documentElement && document.documentElement.clientWidth )
  {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
  }
  else if( document.body && document.body.clientWidth )
  {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
  }
  return myWidth;
}

function winHeight()
{
  var myHeight = 0;
  if( typeof( window.innerHeight ) == 'number' )
  {
    //Non-IE
    myHeight = window.innerHeight;
  }
  else if( document.documentElement && document.documentElement.clientHeight )
  {
    //IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.clientHeight;
  }
  else if( document.body && document.body.clientHeight )
  {
    //IE 4 compatible
    myHeight = document.body.clientHeight;
  }
  return myHeight;
}

function getScrollY()
{
  var scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' )
 	{
    //Netscape compliant
    scrOfY = window.pageYOffset;
  }
  else if( document.body && document.body.scrollTop )
  {
    //DOM compliant
    scrOfY = document.body.scrollTop;
  }
  else if( document.documentElement && document.documentElement.scrollTop )
  {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
  }
  return scrOfY;
}

function getScrollY()
{
  var scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' )
 	{
    //Netscape compliant
    scrOfY = window.pageYOffset;
  }
  else if( document.body && document.body.scrollTop )
  {
    //DOM compliant
    scrOfY = document.body.scrollTop;
  }
  else if( document.documentElement && document.documentElement.scrollTop )
  {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
  }
  return scrOfY;
}

function getScrollX()
{
  var scrOfX = 0;
  if( typeof( window.pageXOffset ) == 'number' )
 	{
    //Netscape compliant
    scrOfX = window.pageXOffset;
  }
  else if( document.body && document.body.scrollLeft )
  {
    //DOM compliant
    scrOfX = document.body.scrollLeft;
  }
  else if( document.documentElement && document.documentElement.scrollLeft )
  {
    //IE6 standards compliant mode
    scrOfX = document.documentElement.scrollLeft;
  }
  return scrOfX;
}

function checkContactsForm()
{
	var reg = document.contacts_form;
	var fields_array = Array('name','company','email','phone','txt');
	var messages_array = Array('Please, enter Your name!','Please, enter company name!','Please, enter Your e-mail!','Please, enter Your phone!','Please, enter some text!');
	
	for(i = 0; i < fields_array.length; i++)
	{
		eval("var curr_field = reg." + fields_array[i] + ";");
		
		if(trim(curr_field.value) == '')
		{
			curr_field.focus();
			showLightboxAlert(messages_array[i], 'Error', 'document.contacts_form.' + fields_array[i] + '.focus();');
			return false;
		}
		else if(fields_array[i] == 'email')
		{
			var regex = new RegExp(/^(.+){3,}\@(.+){3,}\.([a-z]+){2,}$/);
			var match = regex.exec(curr_field.value);
			if (match == null)
			{
				curr_field.focus();
				showLightboxAlert('Enter valid e-mail!', 'Error', 'document.contacts_form.' + fields_array[i] + '.focus();');
				return false;
			}
		}
	}
	
	reg.submit();
	return true;
}

function textSize(cfg)
{
	var tt = document.getElementById('text_string');
	
	if(cfg == 0) tt.style.fontSize = '11px';
	else if(cfg == 1) tt.style.fontSize = parseInt(tt.style.fontSize) - 1 + 'px';
	else if(cfg == 2) tt.style.fontSize = parseInt(tt.style.fontSize) + 1 + 'px';
}

function closePic()
{
	if(document.getElementById('showPreview')) 
	{
		document.body.removeChild(document.getElementById('showPreview'));
		document.body.removeChild(document.getElementById('showPreviewPic'));
		
		var elementBody = document.getElementsByTagName('html');
		elementBody[0].style.overflow = '';
		elementBody[0].onselectstart = function() {return true;};
	}
}

function showBigGallery(img, txt)
{
	//opera fix
	var agt = navigator.userAgent.toLowerCase();
  var is_opera = (agt.indexOf("opera") != -1);
	if(is_opera) txt = Url.decode(txt);
	
	var sizes = getPageSize();
	var scrollWidth = getScrollX();
	var scrollHeight = getScrollY();
	var windowWidth = winWidth();
	var windowHeight = winHeight();
	var bodyHeight = getPageSize();
	
	//main div
	dl = document.createElement('div');
	dl.id = 'showPreview';
	dl.style.position = 'absolute';
	dl.style.width = '100%';
	//dl.style.height = parseInt(document.getElementById('allover').offsetHeight) + 40 + 'px';
	dl.style.height = bodyHeight[1] + 'px';
	dl.style.backgroundColor = '#000000';
	dl.style.top = 0+'px';
	//dl.style.top = scrollHeight+'px';
	dl.style.left = scrollWidth+'px';
	dl.style.textAlign = 'center';
	dl.style.filter='alpha(opacity=70)';
	dl.style.opacity='.70';
	dl.style.zIndex = 1000;
	
	//pic div
	pl = document.createElement('div');
	pl.id = 'showPreviewPic';
	pl.style.cssText = 'float:left;';
	pl.style.position = 'absolute';
	pl.style.backgroundColor = '#FFFFFF';
	pl.style.top = ((windowHeight/2)+scrollHeight)-200+'px';
	pl.style.left = '50%';
	pl.style.marginLeft = '-251px';
	pl.style.padding = '10px 5px 10px 14px';
	pl.style.width = '503px';
	pl.style.height = '415px';
	pl.style.textAlign = 'center';
	pl.style.zIndex = 1001;
	pl.style.backgroundImage = 'url(\'http://hafsanitaer.com/images/default/spinner.gif\')';
	pl.style.backgroundPosition = 'center';
	pl.style.backgroundRepeat = 'no-repeat';
	
	//close div
	cl = document.createElement('div');
	cl.id = 'showPreviewPicClose';
	cl.style.cssText = 'float:left;';
	cl.style.width = '500px';
	//cl.style.border = 'red 1px solid';
	cl.style.backgroundColor = '#FFFFFF';
	cl.style.textAlign = 'left';
	cl.style.padding = '10px 0px 10px 0px';
	cl_in = '<div style="float:left;width:400px;font-size:12px;" class="green">' + txt + '</div>';
	cl_in += '<div style="float:right;width:90px;text-align:left;"><a href="javascript:closePic();" style="text-decoration:none;color:#666666;white-spacing:nowrap;">Close <img src="http://hafsanitaer.com/images/default/close.gif" alt="Close" style="vertical-align:middle;border:0px;"/></a></div>';
	cl.innerHTML = cl_in;
	
	//pic
	pic_div = document.createElement('div');
	pic_div.style.cssText = 'float:left;';
	pic_div.style.width = '493px';
	pic_div.style.height = '370px';
	
	pic = document.createElement('img');
	pic.id = 'imagePreview';
	pic.src = img;
	pic.setAttribute('alt', '');
	pic.setAttribute('border', '0');
	
	pic_div.appendChild(pic);
	pl.appendChild(pic_div);
	pl.appendChild(cl);
	
	document.body.insertBefore(dl, document.body.firstChild);
	document.body.insertBefore(pl, document.body.firstChild);
	
	var elementBody = document.getElementsByTagName('html');
	elementBody[0].style.overflow = 'hidden';
	elementBody[0].onselectstart = function() {return false;};
	
	scroll(0, scrollHeight);
}

function sendToFriend(product_id)
{
	document.open('http://hafsanitaer.com/send_to_friend.php?product_id='+product_id, 's2f','width=400, height=200');
}

function closeVideo()
{
	if(document.getElementById('showPreviewVideo')) 
	{
		document.body.removeChild(document.getElementById('showPreviewVideo'));
		document.body.removeChild(document.getElementById('showPreviewVideoPlayer'));
		
		var elementBody = document.getElementsByTagName('html');
		elementBody[0].style.overflow = '';
		elementBody[0].onselectstart = function() {return true;};
	}
}

function showVideoPlayer(video, title, txt)
{
	//opera fix
	var agt = navigator.userAgent.toLowerCase();
  var is_opera = (agt.indexOf("opera") != -1);
	if(is_opera) txt = Url.decode(txt);
	
	var sizes = getPageSize();
	var scrollWidth = getScrollX();
	var scrollHeight = getScrollY();
	var windowWidth = winWidth();
	var windowHeight = winHeight();
	var bodyHeight = getPageSize();
	
	//main div
	dl = document.createElement('div');
	dl.id = 'showPreviewVideo';
	dl.style.position = 'absolute';
	dl.style.width = '100%';
	//dl.style.height = parseInt(document.getElementById('allover').offsetHeight) + 40 + 'px';
	dl.style.height = bodyHeight[1] + 'px';
	dl.style.backgroundColor = '#000000';
	dl.style.top = 0+'px';
	//dl.style.top = scrollHeight+'px';
	dl.style.left = scrollWidth+'px';
	dl.style.textAlign = 'center';
	dl.style.filter='alpha(opacity=70)';
	dl.style.opacity='.70';
	dl.style.zIndex = 1000;
	
	//pic div
	pl = document.createElement('div');
	pl.id = 'showPreviewVideoPlayer';
	pl.style.cssText = 'float:left;';
	pl.style.position = 'absolute';
	pl.style.backgroundColor = '#FFFFFF';
	pl.style.top = ((windowHeight/2)+scrollHeight)-290+'px';
	pl.style.left = '50%';
	pl.style.marginLeft = '-327px';
	pl.style.padding = '10px 10px 10px 10px';
	pl.style.width = '640px';
	pl.style.height = '550px';
	pl.style.textAlign = 'center';
	pl.style.zIndex = 1001;
	pl.style.backgroundImage = 'url(\'http://hafsanitaer.com/images/default/spinner.gif\')';
	pl.style.backgroundPosition = 'center';
	pl.style.backgroundRepeat = 'no-repeat';
	
	//close div
	cl = document.createElement('div');
	cl.id = 'showPreviewVideoClose';
	cl.style.cssText = 'float:left;';
	cl.style.width = '640px';
	//cl.style.border = 'red 1px solid';
	cl.style.backgroundColor = '#FFFFFF';
	cl.style.textAlign = 'left';
	cl.style.padding = '10px 0px 10px 0px';
	cl_in = '<div style="float:left;width:500px;font-size:12px;" class="green">' + txt + '</div>';
	cl_in += '<div style="float:right;width:90px;text-align:left;"><a href="javascript:closeVideo();" style="text-decoration:none;color:#666666;white-spacing:nowrap;">Close <img src="http://hafsanitaer.com/images/default/close.gif" alt="Close" style="vertical-align:middle;border:0px;"/></a></div>';
	cl.innerHTML = cl_in;
	
	//pic
	video_div = document.createElement('div');
	video_div.id = 'player';
	video_div.style.cssText = 'float:left;';
	video_div.style.width = '640px';
	video_div.style.height = '500px';
	
	//video_div.innerHTML = eval(video_div_inner);
	
	pl.appendChild(video_div);
	pl.appendChild(cl);
	
	document.body.insertBefore(dl, document.body.firstChild);
	document.body.insertBefore(pl, document.body.firstChild);
	
	var so = new SWFObject("http://hafsanitaer.com/player.swf","mpl","640","500","7");
	so.addParam("allowscriptaccess","always");
	so.addParam("allowfullscreen","true");
	so.addParam("flashvars","&description=" + txt + "&file=" + video + "&title=" + title + "&backcolor=00543f&frontcolor=FFFFFF&lightcolor=53a48f&screencolor=000000&logo=http://hafsanitaer.com/images/default/haf_watermark.png");
	so.write("player");
	
	var elementBody = document.getElementsByTagName('html');
	elementBody[0].style.overflow = 'hidden';
	elementBody[0].onselectstart = function() {return false;};
}

var jScrCon = 'jScrTr';
var jScrCnt = 4;
var jScrImgWidth = 60;
var jScrImgHeight = 45;
var jScrImages = new Array();
var jScrCurPos = 0;
var jScrOpac = 0;

var jScrAction = 0;
var jScrOff = 0;
var jScrTimer = 0;
var jScrTop = 0;

function jScrInit()
{
	jScrPreload();
	
	if ( jScrCurPos > jScrImgArray.length - jScrCnt ) jScrCurPos = jScrImgArray.length - jScrCnt;
	if ( jScrCurPos < 0 ) jScrCurPos = 0;
	
	var jScrDiv = document.getElementById( 'jScrDiv' );
	jScrDiv.style.width = ( jScrCnt * jScrImgWidth ) + ( jScrCnt * 12 ) + 'px';
	
	var jScrObj = document.getElementById( jScrCon );

	jScrRemoveAll( jScrObj );
	
	for ( var i = jScrCurPos; i < jScrCnt + jScrCurPos; i++ )
	{
		if ( jScrImages[i] && jScrImages[i] != 'undefined' )
		{
			var td = document.createElement( 'td' );
			td.style.width = jScrImgWidth + 'px';
			td.style.height = jScrImgHeight + 'px';
			td.style.backgroundColor = '#ffffff';
			
			var a = document.createElement( 'a' );
			a.id = 'jScr_aid_' + i;
			a.href = jScrImgArrayBig[i];
			a.className = 'highslide';
			a.setAttribute('onclick', 'jScrChange( this.id ); return hs.expand(this);');
			a.onclick = function(){jScrChange(this.id); return hs.expand(this);}
			
			var img = document.createElement( 'img' );
			img = jScrImages[i];
			img.id = 'jScr_tid_' + i;
			//img.style.width = jScrImgWidth + 'px';
			//img.style.height = jScrImgHeight + 'px';
			//img.style.display = 'block';
			//img.style.margin = '0 0';
			//img.style.padding = '0';
			
			if ( i == jScrTop ) img.style.border = '3px solid #c6c6c6'; else img.style.border = '3px solid #c6c6c6';
			
			a.appendChild( img );	
			td.appendChild( a );
			
			jScrObj.appendChild( td );
			
			//document.getElementById( 'jScr_aid_' + i ).onclick = function() { jScrChange( this.id ); }
			//document.getElementById( 'big_pic' ).src = jScrImgArrayBig[jScrCurPos];
			document.getElementById( 'jScr_tid_' + jScrCurPos ).style.border = '3px solid #c6c6c6';	
			jScrTop = jScrCurPos; 
		}
	}
}

function jScrClick( id )
{
	var t = 1 + parseInt( jScrTop );
	
	if ( t >= jScrImgArray.length ) t = 0;
	
	jScrChange( 'jScr_tid_' + ( t ) );
	jScrNext();
}

function jScrChange( pos )
{ 
	var a = pos.split( '_' );
	
	if ( document.getElementById( 'jScr_tid_' + jScrTop ) ) 
	{
		//opacity( 'big_pic', 100, 0, 300 );
		document.getElementById( 'jScr_tid_' + jScrTop ).style.border = '3px solid #c6c6c6';
	}
	
	jScrTop = a[2];
	
	if ( document.getElementById( 'jScr_tid_' + jScrTop ) ) 
		document.getElementById( 'jScr_tid_' + jScrTop ).style.border = '3px solid #c6c6c6';
	
	//document.getElementById( 'big_pic' ).src = jScrImgArrayBig[ a[2] ];
	//opacity( 'big_pic', 0, 100, 300 );
}

function jScrPreload()
{
	for ( var i = 0; i < jScrImgArray.length; i++ ) 
	{
		jScrImages[i] = document.createElement( 'img' );
		jScrImages[i].src = jScrImgArray[i];
	}
}

function jScrRemoveAll( node )
{
	while ( node.hasChildNodes() )
	{
		node.removeChild( node.firstChild );
	}
}

function jScrNext()
{
	if ( jScrImgArray.length <= jScrCnt ) return;
	if ( jScrAction == 1 ) return; else jScrAction = 1;
	
	var jScrObj = document.getElementById( jScrCon );
	
	jScrCurPos++;	
	
	if ( jScrCurPos >= jScrImgArray.length ) jScrCurPos = 0;
	
	tmpPos = jScrCurPos + jScrCnt - 1;
	
	if ( tmpPos >= jScrImgArray.length ) tmpPos = tmpPos - jScrImgArray.length;

	var td = document.createElement( 'td' );
	td.style.width = jScrImgWidth + 'px';
	td.style.height = jScrImgHeight + 'px';
	
	var a = document.createElement( 'a' );
	a.id = 'jScr_aid_' + tmpPos;
	a.href = jScrImgArrayBig[tmpPos];
	a.className = 'highslide';
	a.setAttribute('onclick', 'jScrChange( this.id ); return hs.expand(this);');
	a.onclick = function(){jScrChange(this.id); return hs.expand(this);}
		
	var img = document.createElement( 'img' );
	img = jScrImages[tmpPos];
	img.id = 'jScr_tid_' + tmpPos;
	//img.style.width = jScrImgWidth + 'px';
	//img.style.height = jScrImgHeight + 'px';
	//img.style.display = 'block';
	//img.style.margin = '0 0';
	//img.style.padding = '0';
		
	if ( tmpPos == jScrTop )
		img.style.border = '3px solid #c6c6c6';
	else
		img.style.border = '3px solid #c6c6c6';
	
	a.appendChild( img );	
	td.appendChild( a );
	
	jScrObj.appendChild( td );
	
	//document.getElementById( 'jScr_aid_' + tmpPos ).onclick = function() { jScrChange( this.id ); } 
	
	jScrTimer = window.setInterval( 'jScrMoveLeft( "jScr_tid_" + tmpPos )', 1 );
}

function jScrPrev()
{
	if ( jScrImgArray.length <= jScrCnt ) return;
	if ( jScrAction == 1 ) return; else jScrAction = 1;
	
	var jScrObj = document.getElementById( jScrCon );
	
	jScrCurPos--;	
	
	if ( jScrCurPos < 0 ) jScrCurPos = ( jScrImgArray.length - 1 ) % jScrImgArray.length;
	
	var td = document.createElement( 'td' );
	td.style.width = jScrImgWidth + 'px';
	td.style.height = jScrImgHeight + 'px';
	
	var a = document.createElement( 'a' );
	a.id = 'jScr_aid_' + jScrCurPos;
	a.href = jScrImgArrayBig[jScrCurPos];
	a.className = 'highslide';
	a.setAttribute('onclick', 'jScrChange( this.id ); return hs.expand(this);');
	a.onclick = function(){jScrChange(this.id); return hs.expand(this);}
		
	var img = document.createElement( 'img' );
	img = jScrImages[jScrCurPos];
	img.id = 'jScr_tid_' + jScrCurPos;
	//img.style.width = jScrImgWidth + 'px';
	//img.style.height = jScrImgHeight + 'px';
	//img.style.display = 'block';
	//img.style.margin = '0 0';
	//img.style.padding = '0';
		
	if ( jScrCurPos == jScrTop )
		img.style.border = '3px solid #c6c6c6';
	else
		img.style.border = '3px solid #c6c6c6';
	
	a.appendChild( img );	
	td.appendChild( a );
		
	jScrObj.insertBefore( td, jScrObj.firstChild );
	
	//document.getElementById( 'jScr_aid_' + jScrCurPos ).onclick = function() { jScrChange( this.id ); } 
	
	var jScrTbl = document.getElementById( 'jScrTbl' );
	jScrTbl.style.left = -( jScrImgWidth + 4 ) + 'px';
	jScrOff = -( jScrImgWidth + 4 );
	
	jScrTimer = window.setInterval( 'jScrMoveRight( "jScr_tid_" + jScrCurPos )', 1 );
}

function jScrMoveLeft( img )
{
	var jScrTbl = document.getElementById( 'jScrTbl' );
	
	jScrOff += 5;
	jScrOpac += 5;
	
	if ( jScrOff < jScrImgWidth + 5 ) 
	{
		jScrTbl.style.left = '-' + jScrOff + 'px';
		
		//var tImg = document.getElementById( img );	
		//tImg.style.opacity = jScrOpac / 100;
		//tImg.style.filter = 'alpha(opacity=' + jScrOpac + ')';
	}
	else
	{
		jScrOff = 0;
		jScrAction = 0;
		jScrOpac = 0;
		
		window.clearInterval( jScrTimer );
		
		var jScrObj = document.getElementById( jScrCon );
		jScrObj.removeChild( jScrObj.firstChild );
		jScrTbl.style.left = '0px';
	}
}

function jScrMoveRight( img )
{
	var jScrTbl = document.getElementById( 'jScrTbl' );
	
	jScrOff += 5;
	jScrOpac += 5;
	
	if ( jScrOff < 0 ) 
	{
		jScrTbl.style.left = jScrOff + 'px';
		
		//var tImg = document.getElementById( img );	
		//tImg.style.opacity = jScrOpac / 100;
		//tImg.style.filter = 'alpha(opacity=' + jScrOpac + ')';
	}
	else
	{
		jScrOff = 0;
		jScrAction = 0;
		jScrOpac = 0;
		
		window.clearInterval( jScrTimer );
		
		var jScrObj = document.getElementById( jScrCon );
		jScrObj.removeChild( jScrObj.childNodes[jScrObj.childNodes.length - 1] );
		jScrTbl.style.left = '0px';
	}
}


function confirm_delete(form_id) {
	var c = confirm("Are you sure you want to remove this article?");
	eval("var tform = document.delete_form_post_" + form_id + ";");
	if(c == true) tform.submit();
}
