function AddToCompare(cm_modelid)
{
 var req = new JsHttpRequest();
 req.onreadystatechange = function() {
  if (req.readyState == 4) {
   if (req.responseJS.res != '')
    document.getElementById('top_t1').innerHTML = req.responseJS.res;
  }
 }
 req.open('POST','/index_ajax.php',true);
 req.send({ 'act': 'add_to_compare', 'cm_modelid': cm_modelid});
}

function DeleteFromCompare(cm_modelid)
{
 var req = new JsHttpRequest();
 req.onreadystatechange = function() {
  if (req.readyState == 4) {
   if (req.responseJS.res != '')
    document.getElementById('top_t1').innerHTML = req.responseJS.res;
  }
 }
 req.open('POST','/index_ajax.php',true);
 req.send({ 'act': 'delete_from_compare', 'cm_modelid': cm_modelid});
}

function Go(path)
{
 if (path != 0)
  location.href = path;
}

function LoadModels(cc_catid)
{
 document.getElementById('select_model').innerHTML = '<strong>Загрузка...</strong>';

 var req = new JsHttpRequest();
 req.onreadystatechange = function() {
  if (req.readyState == 4) {
    if (req.responseJS.res == 'error')
     document.getElementById('select_model').innerHTML = '';
	else
     document.getElementById('select_model').innerHTML = req.responseJS.res;
  }
 }
 req.open('POST','/index_ajax.php',true);
 req.send({ 'act': 'models_list', 'cc_catid': cc_catid}); 
}

nn4 = (document.layers)? true : false;
ie4 = (document.all)? true : false;
nn6 = (document.getElementById && !ie4)? true : false;
function popupWin(cardName, winW, winH, winTitle) {
//if (nn4 || ie4 || nn6) {
posX = Math.round((screen.width - winW) / 2);
posY = Math.round((screen.height - winH) / 2);
posCode = /*(nn4 || nn6)? 'screenX='+posX+',screenY='+posY :*/ 'left='+posX+',top='+posY;
//} else { posCode = ''; }
//alert(posCode);
cardWindow = window.open('','_blank','menubar=no,toolbar=no,scrollbars=no,status=no,width='+winW+',height='+winH+','+posCode);
cardWindow.document.open();
cardWindow.document.write('<html><head><title>'+winTitle+'<\/title><\/head>');
cardWindow.document.write('<body marginwidth=0 marginheight=0 topmargin=0 leftmargin=0 rightmargin=0 bottommargin=0>');
cardWindow.document.write('<center><img src="'+cardName+'" width="'+winW+'" height="'+winH+'" align="center" /></center><\/body><\/html>');
cardWindow.document.close();
cardWindow.focus();
}
