var myWin;
function openwin(cname,srci,xx,yy)  {
  var img = new Image();
  img.src=srci;
  if (myWin) myWin.close();
  myWin = open("", "displayWindow","width="+xx+",height="+yy+",status=no,toolbar=no,menubar=no");
  myWin.document.open();
  myWin.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">\n');
  myWin.document.write('<html>\n<head><title>'+cname+'</title></head>\n');
  myWin.document.write('<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 background="'+img.src+'">\n<br>\n</body></html>\n');
  myWin.document.close();
}
function loadSecLevelSections(fLevelObj) {
    showContent("/netcat/modules/catalog/ajax.php?action=GS&fLevelSec=" + fLevelObj.value, "sLevelTd");

}

function showContent(link, reloadId) {
    var cont = document.getElementById(reloadId);
    var http = createRequestObject();
    if( http ) {
        http.open('get', link);
        http.onreadystatechange = function () {
            if(http.readyState == 4) {
                cont.innerHTML = http.responseText;
            }
        }
        http.send(null);
    }
}

function createRequestObject() {
    try { return new XMLHttpRequest() }
    catch(e) {
        try { return new ActiveXObject('Msxml2.XMLHTTP') }
        catch(e) {
            try { return new ActiveXObject('Microsoft.XMLHTTP') }
            catch(e) { return null; }
        }
    }
}

function sort(field) {
	if (getCookie('sortBy') == field && getCookie('sortAt') == "1"){
		setCookie('sortAt', '2');
	} else {
		setCookie('sortAt', '1');
	}
	setCookie('sortBy', field);
	document.location = document.location;
	return false;
}
function setPrice() {
	var priceF = document.getElementById("priceF").value;
	var priceT = document.getElementById("priceT").value;
	setCookie("priceF", priceF);
	setCookie("priceT", priceT);
	document.location = document.location;
	return false;
}
function clrPrice() {
	setCookie("priceF", 0);
	setCookie("priceT", 0);
	document.location = document.location;
	return false;
}
function setCookie(name, value) { 
      var valueEscaped = escape(value); 
      var expiresDate = new Date(); 
      expiresDate.setTime(expiresDate.getTime() + 24 * 60 * 60 * 1000);
      var expires = expiresDate.toGMTString(); 
      var newCookie = name + "=" + valueEscaped + "; path=/; expires=" + expires; 
      if (valueEscaped.length <= 4000) document.cookie = newCookie + ";"; 
} 
function getCookie(name) { 
      var prefix = name + "="; 
      var cookieStartIndex = document.cookie.indexOf(prefix); 
      if (cookieStartIndex == -1) return null; 
      var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length); 
      if (cookieEndIndex == -1) cookieEndIndex = document.cookie.length; 
      return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex)); 
}
function showInfo(code){
    window.open('shop.php?id=' + code,'','width=400,location=no, menubar=no, resizable=yes, scrollbars=yes, status=no');
	return false;
}
