// main.js for mts-agro
function reload_code(value)
{
	var rndval = new Date().getTime(); 
	document.getElementById("reload_id").src="includ/kcaptcha/index.php?"+value+"="+rndval;
}

function getSuboptionsValuesByMainoption(index,numberArr1){
    var sSuboptionsValues = aSuboV[numberArr1][index];
    return sSuboptionsValues;
}
function MkSuboptionsValues(index,formName,subName,numberArr){
    var aCurrSuboptionsValues = getSuboptionsValuesByMainoption(index,numberArr);
    var nCurrSuboptionsValuesCnt = aCurrSuboptionsValues.length;
    var oSuboptionsList = document.forms[formName].elements[subName];
    var oSuboptionsListOptionsCnt = oSuboptionsList.options.length;
    oSuboptionsList.length = 0;
    for (i = 0; i < nCurrSuboptionsValuesCnt; i=i+2){
        if (document.createElement){
            var newSuboptionsListOption = document.createElement("OPTION");
            newSuboptionsListOption.text = aCurrSuboptionsValues[i+1];
            newSuboptionsListOption.value = aCurrSuboptionsValues[i];
            (oSuboptionsList.options.add) ? oSuboptionsList.options.add(newSuboptionsListOption) : oSuboptionsList.add(newSuboptionsListOption, null);
        }else{
            oSuboptionsList.options[i/2] = new Option(aCurrSuboptionsValues[i+1], aCurrSuboptionsValues[i], false, false);
        }
    }
}

function ViewImage(ifile,ix,iy)
{
	var win;
	var sWidth;
	var sHeight;
	var NS = (document.layers) ? 1 : 0;
	if (NS)
		{
			sWidth = innerWidth;
			sHeight = innerHeight;
		}
		else
		{
			sWidth = document.body.clientWidth;
			sHeight = document.body.clientHeight;
		}
	leftc = (sWidth - ix)/2;
	topc = (sHeight + 50 - iy)/2;
	var addwin = "left="+leftc+",top="+topc+",width="+ix+",height="+iy+",menubar=no,toolbar=no";
	win = window.open("","imageviewer",addwin);
	if (NS)
		{
			sWidth = win.innerWidth;
			sHeight = win.innerHeight;
		}
		else
		{
			sWidth = win.document.body.clientWidth;
			sHeight = win.document.body.clientHeight;
		}
	if(sWidth!=ix || sHeight!=iy)
		{
			win.close();
			setTimeout("ViewImage('"+ifile+"',"+leftc+","+topc+","+ix+","+iy+",'"+ititle+"')", 250);
			return;
		}
	win.document.open();
	win.document.write("<html><head></head><body>");
	win.document.write('<div style="position:absolute;width:'+ix+'px;height:'+iy+'px;left:0px;top:0px">');
	win.document.write("<img src="+ifile+"></div></body></html>");
	win.document.close();
	win.focus();
}

	function open_window(link,leftw,topw,w,h)
	{
		if (w!=0&&h!=0)
		{
		var win = "left="+leftw+", top="+topw+", width="+w+",height="+h+",menubar=no,location=no,resizable=yes,scrollbars=yes";
		}
		if(w==0&&h!=0)
		{
		var win = "top="+topw+", height="+h+",menubar=no,location=no,resizable=yes,scrollbars=yes";
		}
		if (h==0&&w==0)
		{
		var win = "menubar=no,location=no,resizable=yes,scrollbars=yes";
		}
		if (h==0&&w!=0)
		{
		var win = "left="+leftw+", width="+w+", menubar=no,location=no,resizable=yes,scrollbars=yes";
		}
		newWin = window.open(link,'newWin',win);
		newWin.focus ();
	}

stract=new Image();
stract.src="images/mra.gif";
stract1=new Image();
stract1.src="images/mmta.gif";
stract2=new Image();
stract2.src="transmenu/sub_on1.gif";

