/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/

if (!xmlhttp && typeof(XMLHttpRequest) != 'undefined') {
	
  var xmlhttp = new XMLHttpRequest();
}


function BannerClick(banner, user, session_id){
	
	xmlhttp.open('POST', "baner_click.php", false);
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	
	sendString = "banner=" + banner + "&user=" + user + "&session_id=" + session_id;
	
	xmlhttp.send(sendString);
}


function AddToFavorite(Id, CloneTd, customer){
	
	xmlhttp.open('POST', "add_to_favorite.php", false);
	
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	
	
	sendString = "id=" + Id + "&clone=" + CloneTd + "&customer=" + customer;		
	
	xmlhttp.send(sendString);
	
	if ( xmlhttp.readyState == 4 ){	
	
		var xmlResponse = xmlhttp.responseText;
	}	
	
	document.getElementById("add_to_favorite_" + Id).innerHTML = '<span style="color:#666666; font-size:10px;"><u>В "портфель"</u></span> |';
}


function ShowArticle( id, clone_tb, num ){
	
	xmlhttp.open('POST', "show_article.php", false);	
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	
	
	sendString = "id=" + id + "&clonetb=" + clone_tb + "&compact=1";			
	
	xmlhttp.send(sendString);
	
	var ArtNum = document.getElementById("hidd_num").value;
	
	/*for( r=0; r<ArtNum; r++ ){		
		
		var the_id = document.getElementById("the_id_" + r).value;
		
		document.getElementById("full_td_" + r).innerHTML = "<br style=\"line-height:10px;\"><table cellpadding=\"0\" cellspacing=\"0\"><tr><td width=\"12\" bgcolor=\"#FFFFFF\"><img src=\"img/smallend.gif\" align=\"absmiddle\"></td><td style=\"padding-left:8px;padding-bottom:5px;\" nowrap valign=\"middle\"><a href=\"javascript:ShowArticle('"+ the_id +"', '"+ clone_tb +"', '"+ r +"');\"><u>далее</u></a></td></tr></table>";
		document.getElementById("addons_div_" + r).style.display = "none";		
	}*/
		
	if ( xmlhttp.readyState == 4 ){	
	
		var xmlResponse = xmlhttp.responseText;
		document.getElementById("full_td_" + num).innerHTML = xmlResponse;
		document.getElementById("addons_div_" + num).style.display = "block";
	}		
}


function UpdatePic(pic_id, img_r){
	
	xmlhttp.open('POST', "update_picture.php", false);
	
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	
	
	sendString = "Id=" + pic_id + "&img_r=" + img_r;	
	
	xmlhttp.send(sendString);
	
	if ( xmlhttp.readyState == 4 ){	
	
		var xmlResponse = xmlhttp.responseText;
	}	
	
	document.getElementById("popup_pic").innerHTML = xmlResponse;	
}


function AddAddonDates(Id){	
	
	xmlhttp.open('POST', "addon_in_shop.php", false);
	
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	
	
	var address = document.getElementById('addon_address').value;
	var phone = document.getElementById('addon_phone').value;
	var postal_code = document.getElementById('addon_postal_code').value;
	
	sendString = "id=" + Id + "&address=" + address + "&phone=" + phone + "&postal_code=" + postal_code;		
	
	//alert(sendString);
	
	xmlhttp.send(sendString);
	
	if ( xmlhttp.readyState == 4 ){	
	
		var xmlResponse = xmlhttp.responseText;
	}	
}

function UpdateSelect(id)
{
	xmlhttp.open('POST', "update_child.php?id="+id, false);
	
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	
	
	parent_id = document.getElementById("id_izdanie").value;
	
	sendString = "parent_id=" + parent_id;	
	
	xmlhttp.send(sendString);
	
	if ( xmlhttp.readyState == 4 )
	{
		var xmlResponse = xmlhttp.responseText;
	}	
	
	document.getElementById("razdel").innerHTML = xmlResponse;	
}
