﻿

var sh1=0;
var sh2=0;

function sh(id)
{
 if (id==1)
 {
  if (sh1) sh1=0;
  else     sh1=1;
  return   sh1;
 } else
 {
  if (sh2) sh2=0;
  else     sh2=1;
  return   sh2;
 }
}

function showHide(item, toggle) {
    obj = document.getElementById(item);
    if(obj) {
		if(toggle == 0){
        	obj.style.display = "none";
    	} else {
            obj.style.display = "block";
    	}
    }
}

function help(topic)
{
 window.open("/help.cgi?id="+topic,'Help',"width=600,height=500,left=100,top=100,copyhistory=no,directories=no,menubar=no,location=no,resizable=no,scrollbars=yes");
}

function operator_address_map(operator)
{
 var form = document.forms["order"];
 aid = form["operator_address"].options[form["operator_address"].selectedIndex].value;
 window.open("/img/maps/"+operator+'.'+aid+'.jpg','Map',"width=550,height=550,left=100,top=100,copyhistory=no,directories=no,menubar=no,location=no,resizable=no,scrollbars=yes");
}

function orderpreviewchange(value)
{
  var form = document.forms["order"];
  var iname='/img--i-';

  if (!value)
  {
   value = form["print"].options[form["print"].selectedIndex].value;
  }

  var ivalue=Math.abs(Math.round(value));
  var reA = /\.$/;
  if (reA.test(value))
  {
   iname=iname+titles[ivalue]+'-w-120-t-1';
  } else
  {
   iname=iname+ivalue+'-w-120';
  }
  iname=iname+'.jpg';

  document.preview.src=iname;
}

function doaction(loc,msg)
{
 if (
	confirm(msg)
 )
 {
   document.location.href=loc;
 }
}

function emoticon(text) {
	var txtarea = document.comment.comment;
	text = ' ' + text + ' ';
	if (txtarea.createTextRange && txtarea.caretPos) {
		var caretPos = txtarea.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
		txtarea.focus();
	} else {
		txtarea.value  += text;
		txtarea.focus();
	}
}
