function OnLoadWebSite() {
	showCarouselBlocks();
}
function showCarouselBlocks() {
	if (document.getElementById("FA02Carousel")) {
		document.getElementById("FA02Carousel").style.visibility = "visible";
	}
}
function ValidateContactForm (form) { 
  var fname = form.fullname.value;   
  var country = form.country.value;   
	var phone = form.phone.value;
  var email = form.email.value;   

  if (!fname)	{
    alert("You must enter your full name.");
    return false;
	} else if (!country) {
		alert("You must select your country.");
		return false;
	} else if ((!phone)&&(!email)) {
		alert("You must enter your phone number or your email address.");
		return false;
	} else if ((email)&&((email.indexOf('@') == -1) || (email.indexOf('.') == -1))) {
		alert("Wrong email format.");
		return false;
	} else {
		return true;
	}
}
function ValidateNewsLetterForm (form) { 
  var name = form.name.value;   
  var surname = form.surname.value;   
  var email = form.email.value;   
  var company_email = form.company_email.value;   

  if (!name)	{
    alert("You must enter your name.");
    return false;
  } else if (!surname) {
    alert("You must enter your surname.");
		return false;
  } else if (!email) {
    alert("You must enter your email address.");
		return false;
  } else if ((email)&&((email.indexOf('@') == -1) || (email.indexOf('.') == -1))) {
	  alert("Wrong email format.");
	  return false;
  } else if ((company_email)&&((company_email.indexOf('@') == -1) || (company_email.indexOf('.') == -1))) {
	  alert("Wrong company email format.");
	  return false;
  } else {
	  return true;
  }
}
function ValidateBonusCardApplicationForm (form) { 
  var name = form.name.value;   
  var surname = form.surname.value;   
  var address = form.address.value;   
  var city = form.city.value;   
  var phone = form.phone.value;   

  if (!name) {
    alert("You must enter your name.");
    return false;
  } else if (!surname) {
    alert("You must enter your surname.");
		return false;
  } else if (!address) {
    alert("You must enter your address.");
		return false;
  } else if (!city) {
    alert("You must enter your city.");
		return false;
  } else if (!phone) {
    alert("You must enter your phone number.");
		return false;
  } else {
	  return true;
  }
}
function ValidateFeedbackForm (form) { 
  var name = form.name.value;   
  var surname = form.surname.value;   
  var address = form.address.value;   
  var city = form.city.value;   
  var phone = form.phone.value;   
  var email = form.email.value;   

  if (!name) {
    alert("You must enter your name.");
    return false;
  } else if (!surname) {
    alert("You must enter your surname.");
		return false;
  } else if (!address) {
    alert("You must enter your address.");
		return false;
  } else if (!city) {
    alert("You must enter your city.");
		return false;
  } else if (!phone) {
    alert("You must enter your phone number.");
		return false;
  } else if (!email) {
    alert("You must enter your email address.");
		return false;
	} else if ((email)&&((email.indexOf('@') == -1) || (email.indexOf('.') == -1))) {
		alert("Wrong email format.");
		return false;
  } else {
	  return true;
  }
}
function ValidateMailingListRequestForm (form) { 
  var email = form.email.value;   

	if (!email) {
		alert("You must enter your email.");
		return false;
	} else if ((email.indexOf('@') == -1) || (email.indexOf('.') == -1)) {
		alert("Wrong email format.");
		return false;
	} else {
		return true;
	}
}
function showMap() {
	w_width = 640;
	w_height = 400;
	if (screen) {
		w_left = (screen.availWidth - w_width)/2;
		w_top = ((screen.availHeight - w_height)/2)-20;
	}
	theWindowParam = 'width='+w_width+',height='+w_height+',left='+w_left+',top='+w_top+',status=no,resizable=no,scrollbars=no';

	fparam = 'showmap.html';
  window.showMapWindow = open(fparam, 'showMapWindow', theWindowParam);
	setTimeout('if(showMapWindow&&!showMapWindow.closed)showMapWindow.focus()',100);
}
function showContact() {
	w_width = 640;
	w_height = 400;
	if (screen) {
		w_left = (screen.availWidth - w_width)/2;
		w_top = ((screen.availHeight - w_height)/2)-20;
	}
	theWindowParam = 'width='+w_width+',height='+w_height+',left='+w_left+',top='+w_top+',status=no,resizable=no,scrollbars=no';

	fparam = 'showcontact.html';
  window.showContactWindow = open(fparam, 'showContactWindow', theWindowParam);
	setTimeout('if(showContactWindow&&!showContactWindow.closed)showContactWindow.focus()',100);
}
function printPage() {
  lochref = '' + this.location;
	if (lochref.indexOf('?') > 0) {
		lochref = '?' + lochref.substring((lochref.indexOf('?')) + 1);
	} else {
		lochref = '';
	}

	w_width = 740;
	w_height = 560;
	if (screen) {
		w_left = (screen.availWidth - w_width)/2;
		w_top = ((screen.availHeight - w_height)/2)-20;
	}
	theWindowParam = 'width='+w_width+',height='+w_height+',left='+w_left+',top='+w_top+',status=no,resizable=yes,scrollbars=yes';

	fparam = 'print.php'+lochref;
  window.showPrintWindow = open(fparam, 'showPrintWindow', theWindowParam);
	setTimeout('if(showPrintWindow&&!showPrintWindow.closed)showPrintWindow.focus()',100);
}
function emailPage() {
  lochref = '' + this.location;
	if (lochref.indexOf('?') > 0) {
		lochref = '?' + lochref.substring((lochref.indexOf('?')) + 1);
	} else {
		lochref = '';
	}

	w_width = 500;
	w_height = 400;
	if (screen) {
		w_left = (screen.availWidth - w_width)/2;
		w_top = ((screen.availHeight - w_height)/2)-20;
	}
	theWindowParam = 'width='+w_width+',height='+w_height+',left='+w_left+',top='+w_top+',status=no,resizable=yes,scrollbars=no';

	fparam = 'tools/emailpage/index.php'+lochref;
  window.showEmailWindow = open(fparam, 'showEmailWindow', theWindowParam);
	setTimeout('if(showEmailWindow&&!showEmailWindow.closed)showEmailWindow.focus()',100);
}

function popupPage(thePageId,theCtype) {
	url ='';
	if (thePageId!='') {
		url='?pageid='+thePageId;
	}
	if (theCtype != '') {
		if(thePageId == '') {
			url=url+"?";
		} else {
			url=url+"&";
		}
		url=url+'ctype='+theCtype;
	}

	w_width = 540;
	w_height = 640;
	if (screen) {
		w_left = (screen.availWidth - w_width)/2;
		w_top = ((screen.availHeight - w_height)/2)-20;
	}
	theWindowParam = 'width='+w_width+',height='+w_height+',left='+w_left+',top='+w_top+',status=no,resizable=yes,scrollbars=no';

	fparam = 'popup.php'+url;
 	window.showPopupWindow = open(fparam, 'showPopupWindow', theWindowParam);
	setTimeout('if(showPopupWindow&&!showPopupWindow.closed)showPopupWindow.focus()',100);
}
function popupWindow (theWindow, theParam) {

//	newLeft = screen.width
//	newTop = screen.height
	switch (theWindow)
	{
		case 'newmenu':
			window.open('menuform.php?'+theParam, 'NewMenu', 'toolbar=no,status=no,scrollbars=yes,resizable=yes,location=no,menubar=no,directories=no,width=500,height=500,left=50,top=50');
		break
		case 'editmenu':
			window.open('menuform.php?'+theParam, 'EditMenu', 'toolbar=no,status=no,scrollbars=yes,resizable=yes,location=no,menubar=no,directories=no,width=500,height=500,left=50,top=50');
		break
		default:
			return;
	}
}
function changeLangAlert(theLang) {
	alert('The '+theLang+' language is not published yet. Please check back soon.');
}
function changeLang(theLang, theQueryString) {
  lochref = '';
	// Check if already lang parameter is sent
	if (theQueryString.match('lang=') != null) {
		langPos = theQueryString.indexOf('lang=');
		theQueryString = theQueryString.substring(0,(langPos-1))+theQueryString.substring((langPos-1)+8);
	}
	// Check all parameters that 'index.php' files handles
	if (theQueryString != '') {
		lochref = 'index.php?'+theQueryString+'&lang='+theLang;
	} else {
		lochref = 'index.php?lang='+theLang;
	}
	location = lochref;
}
function goToSearch(theform) {
  var theSearchQuery = theform.searchquery.value;
	
  lochref = 'index.php?pageaction=search&searchquery=' + theSearchQuery;
	
	location = lochref;
}
function goToSitemap() {

  lochref = 'index.php?pageaction=sitemap';

	location = lochref;
}



//v1.0
//Copyright 2006 Adobe Systems, Inc. All rights reserved.
function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}

function MainMenuImagesConf(theId, theLang, theCase) {

	if (theCase == '1') { // mouseOver
		document.getElementById("mm_" + theId).src = "layout/images/mm_" + theId + "_" + theLang + "_over.png";
	} else if (theCase == '2') { // mouseOut
		document.getElementById("mm_" + theId).src = "layout/images/mm_" + theId + "_" + theLang + "_on.png";
	}

}

function LinkImagesConf(theId, theLang, theCase) {

	if (theCase == '1') { // mouseOver
		document.getElementById("link_" + theId + "_img").src = "layout/images/link_" + theId + "_img_" + theLang + "_over.gif";
	} else if (theCase == '2') { // mouseOut
		document.getElementById("link_" + theId + "_img").src = "layout/images/link_" + theId + "_img_" + theLang + "_on.gif";
	}

}

function ProductsMoreImageConf(theLang, theCase) {

	if (theCase == '1') { // mouseOver
		document.getElementById("productsmore").src = "layout/images/moreproducts_" + theLang + "_btn_over.gif";
	} else if (theCase == '2') { // mouseOut
		document.getElementById("productsmore").src = "layout/images/moreproducts_" + theLang + "_btn_on.gif";
	}

}

/* template ws_mm_standard_25 functions 

function standard_25_ShowPhotoSrc(theId, theFile, theDescId, theDesc) {

	if (document.getElementById) {
		var c = document.getElementById(theId);
		if (c.style.display != "block") {
			c.innerHTML = '<img src="' + theFile + '">';
		} else {
			c.innerHTML = '<img src="../../layout/images/transparent.gif">';
			c.style.display="none";
		}
	}
	document.getElementById(theId).alt = theDesc;
	document.getElementById(theDescId).value = theDesc;
}
*/
/* template ws_mm_products_30 functions */

function products_30_showPhoto(theId, theLang) {
	w_width = 680;
	w_height = 600;
	if (screen) {
		w_left = (screen.availWidth - w_width)/2;
		w_top = ((screen.availHeight - w_height)/2)-20;
	}
	theWindowParam = 'width='+w_width+',height='+w_height+',left='+w_left+',top='+w_top+',status=no,resizable=yes,scrollbars=yes';

	fparam = 'templates/ws_mm_products_30/showphoto.php?pageid=' + theId + '&lang=' + theLang;
  window.showPhotoWindow = open(fparam, 'showPhotoWindow', theWindowParam);
	setTimeout('if(showPhotoWindow&&!showPhotoWindow.closed)showPhotoWindow.focus()',100);
}

/* template ws_mm_videos_03 functions */

function videos_30_showVideo(theId, theLang) {
	w_width = 520;
	w_height = 450;
	if (screen) {
		w_left = (screen.availWidth - w_width)/2;
		w_top = ((screen.availHeight - w_height)/2)-20;
	}
	theWindowParam = 'width='+w_width+',height='+w_height+',left='+w_left+',top='+w_top+',status=no,resizable=yes,scrollbars=yes';

	fparam = 'templates/ws_mm_videos_03/showvideo.php?pageid=' + theId + '&lang=' + theLang;
  window.showPhotoWindow = open(fparam, 'showPhotoWindow', theWindowParam);
	setTimeout('if(showPhotoWindow&&!showPhotoWindow.closed)showPhotoWindow.focus()',100);
}

function DownloadsBlockNavButtons(BlockNum, CurBlockPage, TotalBlockPages, MaxBlockRecords, QueryString){
	var ajaxRequest; 

	/* setup loading block */
	var new_block_h = parseInt(document.getElementById("block_" + BlockNum).scrollHeight, 10);
	var new_block_w = parseInt(document.getElementById("block_" + BlockNum).scrollWidth, 10);
	new_block_h = new_block_h; // paging row height
	document.getElementById("block_" + BlockNum + "_loading").style.width = new_block_w + "px";
	document.getElementById("block_" + BlockNum + "_loading").style.height = new_block_h + "px";
	
	document.getElementById("block_" + BlockNum + "_loading").style.display = "block";
	// setTimeout('document.images["block_"' + BlockNum + '"_loading_img"].src = "layout/images/loading.gif"', 10); 
	document.getElementById("block_" + BlockNum + "_loading_img").style.marginTop = ((new_block_h / 2) - 16);
	/* */
	
	try {
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try {
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Something is wrong with your browser!");
				return false;
			}
		}
	}
	
	var queryString = "?blockNum=" + BlockNum + "&curpage=" + CurBlockPage + "&totpages=" + TotalBlockPages + "&maxrecs=" + MaxBlockRecords + QueryString;
	
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4) {
			var ajaxDisplay = document.getElementById("block_" + BlockNum);
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
		}
	}
	ajaxRequest.open("GET", "templates/ws_mm_downloads_22/update_block.php" + queryString, true);
	ajaxRequest.send(null); 
}

function ChangeImg(theId, theBlockNum, theCase) {
	if (theCase == '1') {
		document.getElementById(theId + "_" + theBlockNum).src = "layout/images/slide_" + theId + "_over_btn.png";
	} else if (theCase == '2') {
		document.getElementById(theId + "_" + theBlockNum).src = "layout/images/slide_" + theId + "_on_btn.png";
	}
}
