var SITE_DOMAIN = "http://" + window.location.host + "/";
var SITE_DOMAIN_SSL = "https://" + window.location.host + "/";
var SITE_PATH = "/";

var speed = 5; // Scrolling speed

function showPreview(song_id)
{
	window.open("preview.asp?song_id=" + song_id, "preview_win", "width=379, height=200, left=350, top=250")
}

function addToCart(id, type)
{	
	window.frames["ShoppingCartFrame"].document.location.href = "shopping_cart_frame.asp?event=ADD&id=" + id + "&type=" + type;
}

function showRadio()
{
	window.open("radio.asp", "radio_win", "width=379, height=320, left=330, top=180")
}

function showRadioAvoda()
{
	window.open("radio_avoda.asp", "radio_win", "width=379, height=320, left=330, top=180")
}

function showTrueTone(song_id)
{
	// alert('TRUETONE');
	openCenterWnd("truetone.asp?song_id=" + song_id, 430, 580, 'menubars=0,scrollbars=0', false, 'truetone_win')
}

function scrollDown(contentDivId){
	var theDiv = document.getElementById(contentDivId)
	var contentheight = theDiv.offsetHeight
	
	if (parseInt(theDiv.style.top)>=(contentheight*(-1)+parseInt(theDiv.parentNode.style.height)))
		theDiv.style.top=parseInt(theDiv.style.top)-speed+"px"
		
	scrollDownTimer = setTimeout("scrollDown('" + contentDivId + "')", 20)
}

function scrollUp(contentDivId){	
	var theDiv = document.getElementById(contentDivId)
	var contentheight = theDiv.offsetHeight
	
	if (parseInt(theDiv.style.top)<=0) 
		theDiv.style.top=parseInt(theDiv.style.top)+speed+"px"

	scrollUpTimer = setTimeout("scrollUp('" + contentDivId + "')", 20)
}

function scrollRight(contentDivId){

	var theDiv = document.getElementById(contentDivId)
	var contentWidth = theDiv.offsetWidth
	
	if (parseInt(theDiv.style.left)>=(contentWidth*(-1)+parseInt(theDiv.parentNode.style.width)))
		theDiv.style.left=parseInt(theDiv.style.left)-speed+"px"
		
	scrollRightTimer = setTimeout("scrollRight('" + contentDivId + "')", 20)
}

function scrollLeftZZ(contentDivId){	
    
	var theDiv = document.getElementById(contentDivId)
	var contentWidth = theDiv.offsetWidth
	
	if (parseInt(theDiv.style.left)<=0) 
		theDiv.style.left=parseInt(theDiv.style.left)+speed+"px"

	scrollLeftTimer = setTimeout("scrollLeftZZ('" + contentDivId + "')", 20)
	
}
	
	
function GetXmlHttpObject(handler)
{ 
	var objXmlHttp=null

	if (navigator.userAgent.indexOf("Opera")>=0)
	{
		alert("Opera is not supported") 
		return 
	}
	if (navigator.userAgent.indexOf("MSIE")>=0)
	{ 
		var strName="Msxml2.XMLHTTP"
		if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
		{
			strName="Microsoft.XMLHTTP"
		} 
		try
		{ 
			objXmlHttp=new ActiveXObject(strName)
			objXmlHttp.onreadystatechange=handler 
			return objXmlHttp
		} 
		catch(e)
		{ 
			alert("Error. Scripting for ActiveX might be disabled") 
			return 
		} 
	} 
	if (navigator.userAgent.indexOf("Mozilla")>=0)
	{
		objXmlHttp=new XMLHttpRequest()
		objXmlHttp.onload=handler
		objXmlHttp.onerror=handler 
		return objXmlHttp
	}
} 