// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
//																								   //
//									WWW.YALLA.CO.IL												   //
//								   כל הזכויות שמורות											   //
//																								   //
//									@ אלמוג נחמיה @												   //
//																								   //
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //

function getIEVersionNumber()
{
    var ua = navigator.userAgent;
    var MSIEOffset = ua.indexOf("MSIE ");
    
    if (MSIEOffset == -1) {
        return 0;
    } else {
        return parseFloat(ua.substring(MSIEOffset + 5, ua.indexOf(";", MSIEOffset)));
    }
}


function getHTTPObject()
{
	var xmlhttp;
	
	if (getIEVersionNumber() >= 5)
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttp = false;
		}
	}
	else
		xmlhttp = false;
	
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		try {
			xmlhttp = new XMLHttpRequest();
		} catch (e) {
			xmlhttp = false;
		}
	}
	return xmlhttp;
}

// Flying Cart - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //

function addToCart(productId,storeId,getDo,getPage,info)
{
	if (document.getElementById('cartLoading'))
	{
		document.getElementById('cartLoading').style.visibility = 'visible';
	}	
	
	http.open("GET", "ajax.flyingCart.php?time=" + new Date().getTime() + "&id=" + productId + "&storeid=" + storeId + "&do=" + getDo + "&page=" + getPage + "&info=" + info, true);
	http.onreadystatechange = addToCart_HttpResponse;
	http.send(null);
}

function addToCart_HttpResponse()
{
	if (http.readyState == 4)
	{
		if	(document.getElementById('flyingCart'))
		{
			document.getElementById('flyingCart').innerHTML = http.responseText;
		}
		
		if (document.getElementById('cartLoading'))
		{
			document.getElementById('cartLoading').style.visibility = 'hidden';
		}
	}
}
 
var http = getHTTPObject();


// Compere Products - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //

function addToCompere(productId,storeId,inComperePage)
{	
	http_compere.open("GET", "ajax.compere.php?time=" + new Date().getTime() + "&id=" + productId + "&storeid=" + storeId + "&inComperePage=" + inComperePage, true);
	http_compere.onreadystatechange = addToCompere_HttpResponse;
	http_compere.send(null);
}

function addToCompere_HttpResponse()
{
	if (http_compere.readyState == 4)
	{		
		if (http_compere.responseText == 'refresh')
		{
			location.reload(true);
		}
	}
}
 
var http_compere = getHTTPObject();
