pic1 = new Image(80, 20); pic1.src="logos/loewe.gif";
pic2 = new Image(209, 20); pic2.src="logos/dolce_gabbana.gif";
pic3 = new Image(40, 40); pic2.src="logos/bmw.gif";
pic4 = new Image(110, 20); pic2.src="logos/azzaro.gif";
pic5 = new Image(141, 40); pic2.src="logos/ralph_lauren.gif";
pic6 = new Image(36, 40); pic2.src="logos/apple.gif";
pic7 = new Image(189, 20); pic2.src="logos/bvlgari.gif";

var xmlHttp;
var theElem;
var GoOn=0;
var ExclLocation="http://"+location.host+"/";
var Waiting;

function urlencode(str) {
str = escape(str);
str = str.replace('+', '%2B');
str = str.replace('%20', '+');
str = str.replace('*', '%2A');
str = str.replace('/', '%2F');
str = str.replace('@', '%40');
return str;
}

function GoBack()
{
	history.go(-1);
}

function logout()
{
	window.location=ExclLocation+"logout.php?url="+urlencode(window.location);
}

function CheckLoginData()
{
		var text=String(document.getElementById("email").value);
		if (String(text).length>0 &&String(text).indexOf("@")<String(text).lastIndexOf("."))
			return true;
		else
		{
			alert("Dit is geen geldig e-mailadres!");
			return false;
		}
}

function ShowOSField(StoreID,FieldName)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
		return;
	var url=ExclLocation+"showOSfield.php?id="+StoreID+"&field="+FieldName;
	theElem="ratingpanel";
	xmlHttp.onreadystatechange=RatingPanelStateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	if (navigator.appName == "Microsoft Internet Explorer") {
		elem("ratingpanel").style.marginTop = document.body.scrollTop + "px";
	} else {
		elem("ratingpanel").style.marginTop = window.pageYOffset + "px";
	}
}


function ShowActivity(StoreID)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
		return;
	var url=ExclLocation+"showactivity.php?id="+StoreID;
	theElem="ratingpanel";
	xmlHttp.onreadystatechange=RatingPanelStateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	if (navigator.appName == "Microsoft Internet Explorer") {
		elem("ratingpanel").style.marginTop = document.body.scrollTop + "px";
	} else {
		elem("ratingpanel").style.marginTop = window.pageYOffset + "px";
	}
}

function ShowStatus(StatusID)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
		return;
	var url=ExclLocation+"showstatus.php?id="+StatusID;
	theElem="ratingpanel";
	xmlHttp.onreadystatechange=RatingPanelStateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	if (navigator.appName == "Microsoft Internet Explorer") {
		elem("ratingpanel").style.marginTop = document.body.scrollTop + "px";
	} else {
		elem("ratingpanel").style.marginTop = window.pageYOffset + "px";
	}
}


function MailingList(StoreID)
{	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
		return;
	var url=ExclLocation+"mail_list.php?id="+StoreID
	theElem="ratingpanel";
	xmlHttp.onreadystatechange=RatingPanelStateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	if (navigator.appName == "Microsoft Internet Explorer") {
		elem("ratingpanel").style.marginTop = document.body.scrollTop + "px";
	} else {
		elem("ratingpanel").style.marginTop = window.pageYOffset + "px";
	}
}

function AdvancedSearch()
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
		return;
	var url=ExclLocation+"advsearch.php?city="+document.getElementById("city").options[document.getElementById("city").selectedIndex].value;
	theElem="ratingpanel";
	xmlHttp.onreadystatechange=RatingPanelStateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	if (navigator.appName == "Microsoft Internet Explorer") {
		elem("ratingpanel").style.marginTop = document.body.scrollTop + "px";
	} else {
		elem("ratingpanel").style.marginTop = window.pageYOffset + "px";
	}
}

function ShowVacatures(StoreID)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
		return;
	var url=ExclLocation+"showvacatures.php?id="+StoreID;
	theElem="ratingpanel";
	xmlHttp.onreadystatechange=RatingPanelStateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	if (navigator.appName == "Microsoft Internet Explorer") {
		elem("ratingpanel").style.marginTop = document.body.scrollTop + "px";
	} else {
		elem("ratingpanel").style.marginTop = window.pageYOffset + "px";
	}
}

function CancelLogin()
{
	if (window.location==ExclLocation+"favlist.php")
			history.go(-1);
	else
		if (window.location==ExclLocation+"shoplist.php")
			history.go(-1);
		else
		if (document.getElementById("reload").value="1")
			CloseRatingPanel()
		else
			if (document.getElementById("loginurl").value=="") 
				location.reload(true);
			else
				window.location=document.getElementById("loginurl").value;
}

function login()
{
	//showOverlay();
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
		return;
	var url=ExclLocation+"login.php?url="+urlencode(window.location);
	theElem="ratingpanel";
	xmlHttp.onreadystatechange=RatingPanelStateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	if (navigator.appName == "Microsoft Internet Explorer") {
		elem("ratingpanel").style.marginTop = document.body.scrollTop + "px";
	} else {
		elem("ratingpanel").style.marginTop = window.pageYOffset + "px";
	}
}

function ShowKoopzondagen(StoreID)
{
	if (document.getElementById("koopzond").innerHTML=="")
	{
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
			return;
		var url=ExclLocation+"/showkoopzondagen.php?id="+StoreID;
		theElem="koopzond";
		xmlHttp.onreadystatechange=stateChanged;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	}
	else
		document.getElementById("koopzond").innerHTML="";
}

function SendSMS(StoreID, ShowInfo)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
		return;
	var url=ExclLocation+"sms.php?id="+StoreID+"&submit="+ShowInfo;
	if (ShowInfo==1)
		url=url+"&phone="+document.getElementById("phonenumber").value;
	theElem="ratingpanel";
	xmlHttp.onreadystatechange=RatingPanelStateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	if (navigator.appName == "Microsoft Internet Explorer") {
		elem("ratingpanel").style.marginTop = document.body.scrollTop + "px";
	} else {
		elem("ratingpanel").style.marginTop = window.pageYOffset + "px";
	}
}

function ShowBrands(StoreID)
{
	if (document.getElementById("mainbrands").innerHTML!="")
		document.getElementById("mainbrands").innerHTML="";
	else
	{
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
			return;
		var url=ExclLocation+"showbrands.php?id="+StoreID;
		theElem="mainbrands";
		xmlHttp.onreadystatechange=stateChanged;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	}
}

function CheckContent(CatID)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
		return;
	var url=ExclLocation+"contentcheck.php?id="+CatID;
	Waiting=0;
	xmlHttp.onreadystatechange=ContentCheckStateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	if (Waiting==1)
		return true;
	else
		return false;
}

function HideAdminRating()
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
		return;
	var url=ExclLocation+"showcoupon.php";
	theElem="couponbox";
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function ShowThemeCats(ThemeID)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
		return;
	var url=ExclLocation+"themecats.php?id="+ThemeID+"&city="+document.getElementById("city").options[document.getElementById("city").selectedIndex].value;
	theElem="themecats";
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function ShowRatingPanel(StoreID)
{
	//showOverlay();
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
		return;
	var url=ExclLocation+"userrating.php?id="+StoreID;
	theElem="ratingpanel";
	xmlHttp.onreadystatechange=RatingPanelStateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	
	if (navigator.appName == "Microsoft Internet Explorer") {
		elem("ratingpanel").style.marginTop = document.body.scrollTop + "px";
	} else {
		elem("ratingpanel").style.marginTop = window.pageYOffset + "px";
	}
}

function CloseRatingPanel()
{
	document.getElementById("ratingpanel").innerHTML="";
	document.getElementById("ratingpanel").style.display="none";
	hideOverlay();
}

function ShowDetailedRating(ShopID)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
		return;
	var url=ExclLocation+"showadmrat.php?details=1&id="+ShopID;
	theElem="couponbox";
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function ShowAdminRating(ShopID)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
		return;
	var url=ExclLocation+"showadmrat.php?id="+ShopID;
	theElem="ratingpanel";
	xmlHttp.onreadystatechange=RatingPanelStateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	
	if (navigator.appName == "Microsoft Internet Explorer") {
		elem("ratingpanel").style.marginTop = document.body.scrollTop + "px";
	} else {
		elem("ratingpanel").style.marginTop = window.pageYOffset + "px";
	}
}

function EnterRating(Index)
{
	for (var i=1; i<=Index; i++)
		document.getElementById("star"+i).src=ExclLocation+"images/star.gif";
}

function ExitRating(Index)
{	
	for (var i=1; i<=Index; i++)
		document.getElementById("star"+i).src=ExclLocation+"images/emptystar.gif";
}

function AddToFav(ShopID, UserID)
{
	if (UserID>0)
	{
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
			return;
		var url=ExclLocation+"addtofavlist.php?id="+ShopID;
		theElem="favbox";
		xmlHttp.onreadystatechange=stateChanged;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	}
	else
	{
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
			return;
		var url=ExclLocation+"login.php?url="+urlencode(ExclLocation+"addtofavlist.php?id="+ShopID+"&reroute=1");
		theElem="ratingpanel";
		xmlHttp.onreadystatechange=RatingPanelStateChanged;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
		if (navigator.appName == "Microsoft Internet Explorer") {
			elem("ratingpanel").style.marginTop = document.body.scrollTop + "px";
		} else {
			elem("ratingpanel").style.marginTop = window.pageYOffset + "px";
		}
	}
}

function RemoveFromFav(ShopID)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
		return;
	var url=ExclLocation+"removefav.php?id="+ShopID;
	theElem="favbox";
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function SetRating(CompID,Rating)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
		return;
	var url=ExclLocation+"setrating.php?save=1&id="+CompID+"&rat="+Rating;
	theElem="ratingbox";
	GoOn=CompID;
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function ShowRatingSumary(CompID)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
		return;
	var url=ExclLocation+"userrating.php?id="+CompID;
	theElem="ratsummary";
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}


function ShowRatingBox(CompID)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
		return;
	var url=ExclLocation+"setrating.php?id="+CompID;
	theElem="ratingbox";
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function ShowCompImage(ImgIndex,ImgCount,CompID)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
		return;
	var url=ExclLocation+"getcompimg.php?index="+ImgIndex+"&count="+ImgCount+"&id="+CompID;
	theElem="img_holder";
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function DisableCombos()
{
	document.getElementById("city").disabled="true";
	var count=document.getElementById("count").value;
	for (var i=1;i<=count;i++)
		if (document.getElementById("combocat"+i)!=null)
			document.getElementById("combocat"+i).disabled="true";
	document.getElementById("theme").disabled="true";
	var currentTheme=document.getElementById("theme").options[document.getElementById("theme").selectedIndex].value;
	if (currentTheme>0)	
		document.getElementById("themesubcat").disabled="true";
}

function RefreshPicture(CityID)
{
	var home;
	var img=document.getElementById("citypic");
	img.onError=GetDefault;
	if(CityID==-2)
		img.src=ExclLocation+"CityImages/internetcity.jpg";
	if(CityID==-1)
	{
		home=ExclLocation.substring(0,ExclLocation.length-1);
		if (window.location==home||window.location==ExclLocation||window.location==ExclLocation+"index.php")
			img.src=ExclLocation+"CityImages/homepage.jpg";
		else
			img.src=ExclLocation+"CityImages/nederland.jpg";
	}
	else
		img.src=ExclLocation+"CityImages/"+CityID+".jpg";
	//DisableCombos();
	//ResetBranches(CityID);
}

function ResetBranches(CityID)
{	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
		return;
	var val1=document.getElementById("combocat1").options[document.getElementById("combocat1").selectedIndex].value;
	var val2="";
	if (document.getElementById("count").value>1)
		val2=document.getElementById("combocat2").options[document.getElementById("combocat2").selectedIndex].value;
	var url=ExclLocation+"resetbranches.php?city="+CityID+"&combocount="+document.getElementById("count").value+"&val1="+val1+"&val2="+val2;
	theElem="mainbranch";
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function GetDefault()
{
	document.getElementById("citypic").src=ExclLocation+"images/img_left.jpg";
	return false;
}

function AddToShopList(ShopID, UserID)
{
	if (UserID>0)
	{
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
			return;
		var url=ExclLocation+"addtoshoplist.php?id="+ShopID;
		theElem="shoplist";
		xmlHttp.onreadystatechange=stateChanged;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	}
	else
	{
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
			return;
		var url=ExclLocation+"login.php?url="+urlencode(ExclLocation+"addtoshoplist.php?id="+ShopID+"&reroute=1");
		theElem="ratingpanel";
		xmlHttp.onreadystatechange=RatingPanelStateChanged;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
		if (navigator.appName == "Microsoft Internet Explorer") {
			elem("ratingpanel").style.marginTop = document.body.scrollTop + "px";
		} else {
			elem("ratingpanel").style.marginTop = window.pageYOffset + "px";
		}
	}
}

function RemoveFromShopList(ShopID)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
		return;
	var url=ExclLocation+"removeshop.php?id="+ShopID;
	theElem="shoplist";
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function SearchByCity(CityID)
{
	window.location=ExclLocation+"search.php?loc="+CityID;
}

function ShowPage(Params)
{
	window.location=ExclLocation+"search.php?"+Params;
}

function ShowShopPage(Params)
{
	window.location=ExclLocation+"shoplist.php?"+Params;
}

function ShowMap(CompID)
{
	if (1==1)
	{
		theEleme="map_canvas";
		document.getElementById(theElem).style.position="absolute";
		document.getElementById(theElem).style.width=500;
		document.getElementById(theElem).style.height=300;
		//alert(document.getElementById(theElem).style.left=(document.body.clientWidth-500)/2);
		//alert(document.getElementById(theElem).style.top=(document.body.clientHeight-300)/2);
	}
}

function ShowPayments(CompID)
{
	if(document.getElementById("pay").innerHTML=="")
	{
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
			return;
		var url=ExclLocation+"showpaymethods.php?id="+CompID;
		theElem="pay";
		xmlHttp.onreadystatechange=stateChanged;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	}
	else
		document.getElementById("pay").innerHTML="";
}

function ShowFils(CompID)
{
	if(document.getElementById("fil").innerHTML=="")
	{
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
			return;
		var url=ExclLocation+"showfils.php?id="+CompID;
		theElem="fil";
		xmlHttp.onreadystatechange=stateChanged;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	}
	else
		document.getElementById("fil").innerHTML="";
}

function ShowLongHours(CompID)
{
	if(document.getElementById("lh").innerHTML=="")
	{
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
			return;
		var url=ExclLocation+"showlhs.php?id="+CompID;
		theElem="lh";
		xmlHttp.onreadystatechange=stateChanged;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	}
	else
		document.getElementById("lh").innerHTML="";
}

function ShowStandards(CompID)
{
	if(document.getElementById("standards").innerHTML=="")
	{
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
			return;
		var url=ExclLocation+"showstds.php?id="+CompID;
		theElem="standards";
		xmlHttp.onreadystatechange=stateChanged;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	}
	else
		document.getElementById("standards").innerHTML="";
}

function ShowHours(CompID)
{
	if(document.getElementById("orar").innerHTML=="")
	{
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
			return;
		var url=ExclLocation+"showschedule.php?id="+CompID;
		theElem="orar";
		xmlHttp.onreadystatechange=stateChanged;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	}
	else
		document.getElementById("orar").innerHTML="";
}

function GetSubCats(Count, aCat)
{
	if(aCat==0)
	{
		document.getElementById("count").value=Count-1;
		document.getElementById("cat"+Count).innerHTML="";
	}
	else
	{	
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
		{
			return;
		}
		var url=ExclLocation+"getcats.php?contentcheck=1&count="+Count+"&parent="+aCat+"&city="+document.getElementById("city").options[document.getElementById("city").selectedIndex].value;
		theElem="cat"+Count;
		document.getElementById("count").value=Count;
		xmlHttp.onreadystatechange=stateChanged;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	}
}

function CalculateCompRating(CompID)
{
	//alert("dada");
	GoOn=0;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
		return;
	var url=ExclLocation+"getrating.php?id="+CompID;
	theElem="ratings";
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function ResetThemes()
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
		return;
	var url=ExclLocation+"themes.php?city="+document.getElementById("city").options[document.getElementById("city").selectedIndex].value;
	var themeID=document.getElementById("theme").options[document.getElementById("theme").selectedIndex].value;
	url=url+"&theme="+themeID;
	if(themeID>0)
		url=url+"&cat="+document.getElementById("themesubcat").options[document.getElementById("themesubcat").selectedIndex].value;
	theElem="themespan";
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}


function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
	if (theElem!=""&&document.getElementById(theElem)!=null)
		document.getElementById(theElem).innerHTML=xmlHttp.responseText;
	if (theElem=="mainbranch")
		ResetThemes();
	if (theElem=="themespan")
		document.getElementById("city").disabled=false;
	if (GoOn!=0)
		CalculateCompRating(GoOn);
}
}

function RatingPanelStateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
	if (theElem!="")
	{
		showOverlay();
		try
		{
			document.getElementById(theElem).innerHTML=xmlHttp.responseText;
		}
		catch (e)
		{
			//document.getElementById(theElem).innerHTML="dsadsa";
		}
		document.getElementById(theElem).style.display="block";
		
		elem("ratingpanel").style.left=(document.body.clientWidth-parseInt(elem("ratingpanel").style.width))/2-parseInt(elem("ratingpanel").style.marginLeft);
	}
}
}

function ContentCheckStateChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		var s=xmlHttp.responseText;
		if (s=="1")
			Waiting=1;
		else
			Waiting=-1;
	}
}

function ThemeStateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
	document.getElementById("themecats").innerHTML=xmlHttp.responseText;
	//alert(document.getElementById("themes").selectedIndex);
	if (document.getElementById("themes").selectedIndex==0)
	{
		document.getElementById("themes").options[0].text="-- Selecteer een thema --";
	}
	else
	{
		document.getElementById("themes").options[0].text="-- Zoek op branch --";
	}
}
}
	

function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
	// Firefox, Opera 8.0+, Safari
	xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 // Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 }
return xmlHttp;
}

function elem(e) {
	return document.getElementById(e);
}

function showOverlay(_color, _opacity) {
	if(!_color) {_color = "#000000";}
	if(!_opacity) {_opacity = 70;}
	//alert(document.body.scrollWidth);
	elem('overlay').style.width = document.body.scrollWidth;
	elem('overlay').style.height = document.body.scrollHeight;
	elem('overlay').style.backgroundColor = _color;
	elem('overlay').style.filter = "alpha(opacity=" + _opacity + ")";
	elem('overlay').style.opacity = "." + _opacity;
	elem('overlay').style.display = "block";
}

function hideOverlay() {
	elem('overlay').style.display = "none";
}

var distance = 40;
var speed = 50;
var _elem = 0;
var count = 0;

function scroll_init() {	
	images = new Array();
	images[0] = "loewe.gif";
	images[1] = "dolce_gabbana.gif";
	images[2] = "bmw.gif";
	images[3] = "azzaro.gif";
	images[4] = "ralph_lauren.gif";
	images[5] = "apple.gif";
	images[6] = "bvlgari.gif";
	
	temp = "";
	total = 0;
	for(x = 0; x < images.length; x++) {
		temp += "<img src='" + ExclLocation + "logos/" + images[x] + "' id='scroller_img_" + x + "' align='absmiddle' style='margin-right: " + distance + "px;'>";
	}
	document.getElementById("scroller").innerHTML = temp;
}

function scroll() {
	temp = eval("document.getElementById('scroller_img_" + _elem + "');");
	if(temp.style.marginLeft == "") {
		temp.style.marginLeft = temp.style.marginLeft - 1;
	} else {
		margin_left = parseInt(temp.style.marginLeft.toString().replace("px", ""));
		temp.style.marginLeft = margin_left - 1;
	}
	count++;
	if(count == temp.width + distance) {
		_elem++;
		if(_elem == images.length){
			_elem = 0;
			temp = "";
			for(x = 0; x < images.length; x++) {
				temp += "<img src='" + ExclLocation + "logos/" + images[x] + "' id='scroller_img_" + x + "' align='absmiddle' style='margin-right: " + distance + "px;'>";
			}
			document.getElementById("scroller").innerHTML = temp;
			count = 0;
		} else {
			temp = "";
			for(x = _elem; x < images.length; x++) {
				temp += "<img src='" + ExclLocation + "logos/" + images[x] + "' id='scroller_img_" + x + "' align='absmiddle' style='margin-right: " + distance + "px;'>";
			}
			for(x = 0; x < _elem; x++) {
				temp += "<img src='" + ExclLocation + "logos/" + images[x] + "' id='scroller_img_" + x + "' align='absmiddle' style='margin-right: " + distance + "px;'>";
			}
			document.getElementById("scroller").innerHTML = temp;
			count = 0;
		}
	}
}

