/* FOR BACKGROUND */
var view;
function initResize() {
	view = document.getElementById("bg");
	if(view) {
		view.width = view.clientWidth;
		view.height = view.clientHeight;
		initBg();
		setTimeout("initBg()", 10);
	}
}
function initBg() {
	if (window.innerHeight){
		var w = window.innerWidth; 
		var h = window.innerHeight;
	} else {
		var w = document.documentElement.clientWidth; 
		var h = document.documentElement.clientHeight;
	};
	
	if (view.offsetHeight < h){
		view.style.width = 'auto';
		view.style.height = '100%';
	}
	if (view.offsetWidth < w){
		view.style.width = '100%';
		view.style.height = 'auto';
	}	
}
if (window.addEventListener) {
	window.addEventListener("load", initResize, false);
	window.addEventListener("resize", initResize, false);
} else if (window.attachEvent) {
	window.attachEvent("onload", initResize);
	window.attachEvent("onresize", initResize);
}
/* FOR BACKGROUND */

function trim(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}
 
function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
 
function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}

function ValidateStringLength(theString) {
	var theTrimString = trim(theString);
	if (theTrimString.length == '0') {
		return false;	
	} else {
		return true;
	}	
}

function ValidateForgotPasswordForm(theForm) {
  var email = theForm.email.value;
	
	if (!email) {
		alert("Please enter your email.");
		return false;
	} else {
		if ((email.indexOf('@') == -1) || (email.indexOf('.') == -1)) {
			alert("Wrong email format.");
			return false;
		} else {
			return true;
		}
	}
}
function ValidateLoginForm(theForm) {
  var username = theForm.username.value;
  var password = theForm.password.value;
	
	if (!username) {
		alert("Please enter your username.");
		return false;
	} else if (!password) {
			alert("Please enter your password.");
			return false;
	} else {
		return true;
	}
}
function goToMember(theAction, thePrevPageParams) {
  //lochref = 'index.php?pageaction=member&action='+theAction;
  lochref = 'index.php?pageaction=member&action='+theAction+'&prevpage='+thePrevPageParams;
	location = lochref;
}

function ValidateContactForm (form, lang) { 
  var fname = form.fullname.value;   
  var country = form.country.value;   
  var email = form.email.value;   
  var phone = form.phone.value;

  if (ValidateStringLength(fname) == false)	{
    alert("You must enter your full name.");
    return false;
	} else if (!country) {
		alert("You must select your country.");
		return false;
	} else if (ValidateStringLength(email) == false) {
		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 (ValidateStringLength(phone) == false) {
		alert("You must enter your phone number.");
		return false;
	} else {
		return true;
	}
}

function ValidateContactForm_2 (form) { 
  var firstname = form.fname.value;
  var lastname = form.lname.value;
  var companyname = form.comname.value;  
  var country = form.country.value;   
  var phone = form.phone.value;
  var email = form.email.value;

  if (ValidateStringLength(firstname) == false) {
    alert("You must enter your first name.");
    return false;
  } else if (ValidateStringLength(lastname) == false) {
	  alert("You must enter your last name.");
	  return false;
  } else if (ValidateStringLength(companyname) == false) {
	  alert("You must enter your company name.");
	  return false;
  } else if (!country) {
	  alert("You must select your country.");
	  return false;
  } else if (ValidateStringLength(phone) == false) {
	  alert("You must enter your phone number.");
	  return false;
  } else if (ValidateStringLength(email) == false) {
	  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 ValidateNewsletterSignUpForm (form, lang) {
  var email = form.email.value; 

  if (ValidateStringLength(email) == false) {
   	  alert("You must enter your E-mail.");
	  return false;
  } else if ((email.indexOf('@') == -1) || (email.indexOf('.') == -1)) {
	  alert("Wrong email format.");
	  return false;
  } else {
	  return true;
  }
} 
function ClearNewsletterSignUpField(theForm) {
 	theForm.email.value = '';
}

function popupCommentSubmitted() {
	w_width = 500;
	w_height = 200;
	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 = 'templates/ws_mm_advice_01/comment_submitted_popup.php';
  window.popupCommentSubmittedWindow = open(fparam, 'CommentSubmitted', theWindowParam);
	setTimeout('if(popupCommentSubmittedWindow&&!popupCommentSubmittedWindow.closed)popupCommentSubmittedWindow.focus()',100);
}

function popupCommentDenied() {
	w_width = 500;
	w_height = 200;
	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 = 'templates/ws_mm_advice_01/comment_denied_popup.php';
  window.popupCommentDeniedWindow = open(fparam, 'CommentDenied', theWindowParam);
	setTimeout('if(popupCommentDeniedWindow&&!popupCommentDeniedWindow.closed)popupCommentDeniedWindow.focus()',100);
}

function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}

function ValidateServicesEnquiryForm (form) { // Used in Give us your feedback page (pageid=5&ctype=bm)
  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 ValidateProductEnquiryForm (form) { // Used in Give us your feedback page (pageid=5&ctype=bm)
  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 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 currencyConverter(sefUrlStatus) {
	fileLocation = '';
	if (sefUrlStatus!='Y') {
		fileLocation = '';
	} else {
		fileLocation = '/';
	}

	w_width = 810;
	w_height = 302;
	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+',scrollbars=yes,resizable=yes';

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

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(locationParam) {
	
	var lochref;
	
	if (locationParam == "") {
		lochref = '' + this.location;
	} else {
		lochref = '' + locationParam;
	}
  
	if (lochref.indexOf('?') > 0) {
		lochref = '?' + lochref.substring((lochref.indexOf('?')) + 1);
	} else {
		lochref = '';
	}

	w_width = 850;
	w_height = 650;
	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(locationParam) {
  if (locationParam == "") {
	  lochref = '' + this.location;
  } else {
	  lochref = '' + locationParam;
  }
	if (lochref.indexOf('?') > 0) {
		lochref = '?' + lochref.substring((lochref.indexOf('?')) + 1);
	} else {
		lochref = '';
	}

	w_width = 480;
	w_height = 430;
	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 = 'tools/emailpage/index.php'+lochref;
  window.showEmailWindow = open(fparam, 'showEmailWindow', theWindowParam);
	setTimeout('if(showEmailWindow&&!showEmailWindow.closed)showEmailWindow.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 makeDefault(element)
{
	element.style.behavior='url(#default#homepage)'; 
	element.setHomePage('http://www.ktimalaniti.com/index.php');
}

function ClearSearchField(theForm) {
 	theForm.searchquery.value = '';
}


function findPosY(obj) {
  var curtop = 0;
  if(obj.offsetParent)
	  while(1)
	  {
		curtop += obj.offsetTop;
		if(!obj.offsetParent)
		  break;
		obj = obj.offsetParent;
	  }
  else if(obj.y)
	  curtop += obj.y;
  return curtop;
}

function findPosX(obj) {
  var curleft = 0;
  if(obj.offsetParent)
	  while(1) 
	  {
		curleft += obj.offsetLeft;
		if(!obj.offsetParent)
		  break;
		obj = obj.offsetParent;
	  }
  else if(obj.x)
	  curleft += obj.x;
  return curleft;
}

/* POP UP WINDOW FUNCTIONS*/
function getScrollWidth()
{
   var w = window.pageXOffset ||
           document.body.scrollLeft ||
           document.documentElement.scrollLeft;
           
   return w ? w : 0;
} 

function getScrollHeight()
{
   var h = window.pageYOffset ||
           document.body.scrollTop ||
           document.documentElement.scrollTop;
           
   return h ? h : 0;
}

function DisplayPopUpBlock(FileCallPathAndQueryString, WindowWidth, WindowHeight){ 
	var new_block_h = getScrollHeight();
	document.getElementById("popup_block_content").style.marginTop = new_block_h;
	document.getElementById("popup_block_bg").style.marginTop = new_block_h;

	$("#popup_block_bg").css("display","block");
	
	//document.getElementById("popup_block_content").style.display = "block";
	$("#popup_block_content").css("display","block");
	$("#popup_block_content").slideDown("slow");
	    
	if (document.getElementById("popup_block_content_fr")) {
		var objFrame = document.getElementById("popup_block_content_fr"); 
		objFrame.src= FileCallPathAndQueryString; 
		objFrame.style.width = WindowWidth + "px";
		objFrame.style.height = WindowHeight + "px";
	}
}

function HidePopUpBlock(){ 
	var objFrame = document.getElementById("popup_block_content_fr"); 
	objFrame.src = ''; 
	  
  if (document.getElementById("popup_block_bg")) {
	  document.getElementById("popup_block_bg").style.display = "none";
  }
  if (document.getElementById("popup_block_content")) {
	  document.getElementById("popup_block_content").style.display = "none";
  }
}

/* MainMenu Functions */
function MainMenuConf(theId, theCurId) {
	
    var OnBtnCurStatus = document.getElementById("mm_on_"+theId+"_title").style.display;
	if (theCurId != theId) {
	  if (OnBtnCurStatus == "block") {
		document.getElementById("mm_on_"+theId+"_title").style.display = "none";	
		document.getElementById("mm_off_"+theId+"_title").style.display = "block";	
	  } else {
		document.getElementById("mm_on_"+theId+"_title").style.display = "block";	
		document.getElementById("mm_off_"+theId+"_title").style.display = "none";	
	  }
	}
	
}
/* Basic Menu */
function BMTitleImgesConf(theId) {
	var CurDisplayStatus = document.getElementById("bm_"+theId+"_on").style.display;
	if (CurDisplayStatus == "block") {
		document.getElementById("bm_"+theId+"_on").style.display = "none";	
		document.getElementById("bm_"+theId+"_sel").style.display = "block";	
	} else {
		document.getElementById("bm_"+theId+"_on").style.display = "block";	
		document.getElementById("bm_"+theId+"_sel").style.display = "none";	
	}
}

/* SERVICES 06 */
function services_06_MoreBtn(theId) {
	if ($("#more_btn_"+theId+"_on").is(':hidden')) {
		$("#more_btn_"+theId+"_on").css("display", "block");	
		$("#more_btn_"+theId+"_over").css("display", "none");	
	} else {
		$("#more_btn_"+theId+"_on").css("display", "none");	
		$("#more_btn_"+theId+"_over").css("display", "block");	
	}
	
}

function services_06_UpdateGalleryPhoto(theId, theBigFileName) {
	var theBigImgSrc= 'assets/mainmenu/'+theId+'/photos/'+theBigFileName;
	var ImgTags = document.getElementById('big_img_panel').getElementsByTagName('IMG');
	if (ImgTags.length>0) {
		var big_img = ImgTags[0];
		document.getElementById("img_loading").style.display = "block";
		big_img.onload = function() { document.getElementById('img_loading').style.display='none'; };
		big_img.src = theBigImgSrc;
	}
	
	/*
	if (theNomalFileName != '') {
		var theNormalImgSrc= 'assets/modules/kat/articles/'+theAssetParentFolder+'/'+theId+'/photos/'+theNomalFileName;
		document.getElementById("img_btn_block").style.display = "block";
		document.getElementById("view_img").setAttribute('href', theNormalImgSrc);
	} else {
		document.getElementById("img_btn_block").style.display = "none";	
	}
	*/
}

/* ATTRACTIONS 01*/

function attractions_01_UpdateGalleryPhoto(theId, theBigFileName) {
	var theBigImgSrc= 'assets/mainmenu/'+theId+'/photos/'+theBigFileName;
	var ImgTags = document.getElementById('big_img_panel').getElementsByTagName('IMG');
	if (ImgTags.length>0) {
		var big_img = ImgTags[0];
		document.getElementById("img_loading").style.display = "block";
		big_img.onload = function() { document.getElementById('img_loading').style.display='none'; };
		big_img.src = theBigImgSrc;
	}
	
	/*
	if (theNomalFileName != '') {
		var theNormalImgSrc= 'assets/modules/kat/articles/'+theAssetParentFolder+'/'+theId+'/photos/'+theNomalFileName;
		document.getElementById("img_btn_block").style.display = "block";
		document.getElementById("view_img").setAttribute('href', theNormalImgSrc);
	} else {
		document.getElementById("img_btn_block").style.display = "none";	
	}
	*/
}


/* VIDEOS 08 */
function videos_08_ShowVideo(theId, theLang){ // GET
	
	var ajaxRequest;  // The variable that makes Ajax possible!

	/* setup loading block */
	var new_block_h = parseInt(document.getElementById("ShowVideoBlock").scrollHeight, 10);
	var new_block_w = parseInt(document.getElementById("ShowVideoBlock").scrollWidth, 10);
	//new_block_h = new_block_h-30;
	document.getElementById("vid_loading").style.width = new_block_w+"px";
	document.getElementById("vid_loading").style.height = new_block_h+"px";
	
	document.getElementById("vid_loading").style.display = "block";
	setTimeout('document.images["vid_loading_img"].src = "layout/images/loading.gif"', 10);
	$('#vid_loading_img').css("marginTop", (new_block_h/2)-32);
	//document.getElementById("vid_loading_img").style.marginTop = ((new_block_h/2)-32);
	/* */
	
	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 = "?pageid="+theId+"&lang="+theLang;
	//updating - no cache
	//queryString = queryString+"&sid="+Math.random();
	
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4) {
			var ajaxDisplay = document.getElementById("ShowVideoBlock");
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
		}
	}

	ajaxRequest.open("GET", "templates/ws_mm_videos_08/update_video.php"+queryString, true);
	ajaxRequest.send(null); 
}

function videos_08_NavButtons(BlockPageNum, MaxBlockRecs, QueryString){
	var ajaxRequest; 

	/* setup loading block */
	var new_block_h = parseInt(document.getElementById("VideosListArea").scrollHeight, 10);
	var new_block_w = parseInt(document.getElementById("VideosListArea").scrollWidth, 10);
	new_block_h = new_block_h; // paging row height
	document.getElementById("vid_list_loading").style.width = new_block_w + "px";
	document.getElementById("vid_list_loading").style.height = new_block_h + "px";
	
	document.getElementById("vid_list_loading").style.display = "block";
	// setTimeout('document.images["block_"' + BlockNum + '"_loading_img"].src = "layout/images/loading.gif"', 10); 
	//document.getElementById("vid_list_loading_img").style.marginTop = ((new_block_h / 2) - 16);
	$('#vid_list_loading_img').css("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=" + BlockPageNum + "&maxrecs=" + MaxBlockRecs + QueryString;
	
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4) {
			var ajaxDisplay = document.getElementById("VideosListArea");
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
		}
	}
	ajaxRequest.open("GET", "templates/ws_mm_videos_08/update_records.php" + queryString, true);
	ajaxRequest.send(null); 
	
}

function CollapseExpantBlock (theId, theCase) {
  if (theCase == 1) {
	  document.getElementById("collapse_block_" + theId).style.display = "none";
	  document.getElementById("expand_block_" + theId).style.display = "block";
	} else {
	  document.getElementById("collapse_block_" + theId).style.display = "block";
	  document.getElementById("expand_block_" + theId).style.display = "none";
	}
}

/* FA 03 Functions*/
function FA_03_MoreBtn(theId) {
	var CurDisplayStatus = document.getElementById("fa_"+theId+"_more_on").style.display;
	if (CurDisplayStatus == "block") {
		document.getElementById("fa_"+theId+"_more_on").style.display = "none";	
		document.getElementById("fa_"+theId+"_more_over").style.display = "block";	
	} else {
		document.getElementById("fa_"+theId+"_more_on").style.display = "block";	
		document.getElementById("fa_"+theId+"_more_over").style.display = "none";	
	}
}

function ChangeNewsletterBtnImg(theCase, theLang) {
	if (theCase == '1') {
		document.getElementById("signUpBtn").src = "layout/images/signup_over_btn_" + theLang + ".gif";
	} else if (theCase == '2') {
		document.getElementById("signUpBtn").src = "layout/images/signup_on_btn_" + theLang + ".gif";
	}
}
