var url ="";
var what = "";

function GetCatId1(CatId,PageURL,SESSID)
{
	if(CatId!="")
	{
		url=PageURL;
		what = "SetCatId(req.responseText)";
		DoCallback("CatId="+CatId+"&SESSID="+SESSID);
	}
}
function GetCatId(CatId,PageURL)
{
	if(CatId!="")
	{
		url=PageURL;
		what = "SetCatId(req.responseText)";
		DoCallback("CatId="+CatId);
	}
}

function GetBooksByPage(CatId, PageUrl)				//added by giannis vlachopoulos
{
	if (CatId != "")
	{
		url = PageUrl;
		what = "SetCatId(req.responseText)";
		DoCallback("CatId="+CatId);
	}
}

function staredArticle(CatId,PageURL,SESSID)
{
if(CatId!="")
	{
		url=PageURL;
		what = "SetCatId(req.responseText)";
		DoCallback("CatId="+CatId+"&SESSID="+SESSID);
	}
}

function SetCatId(ProductId)
{
	document.getElementById("recordShow2").innerHTML = ProductId;
	if(ProductId!="")
	{
		document.getElementById("recordShow1").style.display = "none";
		document.getElementById("recordShow2").style.display = "block";
	}
	else
	{
		document.getElementById("recordShow1").style.display = "block";
		document.getElementById("recordShow2").style.display = "none";
	}
}

function doStar(ArtId,PageURL,SESSID)
{
	if(ArtId!="")
	{
		url=PageURL;
		what = "SetStar(req.responseText)";
		DoCallback("ArtId="+ArtId+"&SESSID="+SESSID);
	}
}

function Add_To_Cart(ProductId, PageURL, SubscriberId)
{
	if(ProductId!="")
	{
		url=PageURL;
		what = "Process_To_Cart(req.responseText)";
		DoCallback("ProductId="+ProductId+"&SubscriberId="+SubscriberId);
	}
}

function Save_Article(ArticleId, PageURL, SubscriberId)
{
	if(ArticleId!="")
	{
		url=PageURL;
		what = "Save_Article_Subscriber(req.responseText)";
		DoCallback("ArticleId="+ArticleId+"&SubscriberId="+SubscriberId);
	}
}

function SetStar(ProductId)
{
	var a = ProductId.split("@");
	document.getElementById("stared_"+a[0]).innerHTML = a[1];
	if(ProductId!="")
	{
		document.getElementById("notStared_"+a[0]).style.display = "none";
		document.getElementById("stared_"+a[0]).style.display = "block";
	}
	else
	{
		document.getElementById("notStared_"+a[0]).style.display = "block";
		document.getElementById("stared_"+a[0]).style.display = "none";
	}
}

function Process_To_Cart(CartContent)
{
	var splittedCartContent = CartContent.split("@");
	if(splittedCartContent[0] == "message")
	{
		alert(splittedCartContent[1]);
	}
	else
	{
		alert("Το προϊόν προστέθηκε στο καλάθι σας");
		document.getElementById("SHOW_CART").innerHTML = splittedCartContent[0];
		document.getElementById("CART_SUMMERY").innerHTML = splittedCartContent[1];
	}
}

function Save_Article_Subscriber(ArticleContent)
{
	var splittedArticleContent = ArticleContent.split("@");
	if(splittedArticleContent[0] == "Exists")
	{
		alert(splittedArticleContent[1]);
	}
	else
	{
		alert(splittedArticleContent[1]);
	}
}
