/*
	// ------------------------------------------------------------------------------------------------- >>>>>>>>>>
	// Filename : misc.js
	// Author: Cactus Designs (UK) Ltd.
	// Date: 16/04/2008
	// Version: 1.0
	// Description: Global JavaScript file for this client/site
	//						  DO NOT EDIT WITHOUT PRIOR PERMISSON FROM AUTHOR.
	// Notice: This software is not open source and should not be distributed or reused with out consent from the author.
	// Copyright (c) 2008, Cactus Designs (UK) Ltd,  All rights reserved.
	// ------------------------------------------------------------------------------------------------- >>>>>>>>>>
*/

function openAnySize (url, w, h, name) {
	var winopts = "toolbar=no,location=no,directories=no,status=no,";
	winopts = winopts + "menubar=no,scrollbars=yes,resizable=yes,";
	winopts = winopts + "width=" + w + ",height=" + h; remote = window.open(url,name,winopts);
}

/* -------------------------------------------------------------------------------------------------------------- */

function openAnySizeWithToolbar (url, w, h, name) {
	var winopts = "toolbar=yes,location=no,directories=no,status=no,";
	winopts = winopts + "menubar=no,scrollbars=yes,resizable=yes,";
	winopts = winopts + "width=" + w + ",height=" + h; remote = window.open(url,name,winopts);
}

/* -------------------------------------------------------------------------------------------------------------- */

function openAnySizeWithStatus (url, w, h, name) {
	var winopts = "toolbar=no,location=no,directories=no,status=yes,";
	winopts = winopts + "menubar=no,scrollbars=yes,resizable=yes,";
	winopts = winopts + "width=" + w + ",height=" + h; remote = window.open(url,name,winopts);
}

/* -------------------------------------------------------------------------------------------------------------- */

function openAnySizeCanvasMiddle (url, w, h, name) {
    x = (640 - w)/2, y = (480 - h)/2;

    if (screen) {
        y = (screen.availHeight - h)/2;
        x = (screen.availWidth - w)/2;
    }

	var winopts = "toolbar=no,location=no,directories=no,status=no,";
	winopts = winopts + "menubar=no,scrollbars=yes,resizable=yes,";
	winopts = winopts + "width=" + w + ",height=" + h + ",screenX=" + x + ",screenY=" + y + ",top=" + y + ",left=" + x; 
	remote = window.open(url,name,winopts);
}

/* -------------------------------------------------------------------------------------------------------------- */

function findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

/* -------------------------------------------------------------------------------------------------------------- */

function showHideLayers() {
	var i,p,v,obj,args=showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) if ((obj=findObj(args[i]))!=null) { v=args[i+2];
	if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
	obj.visibility=v; }
}

/* -------------------------------------------------------------------------------------------------------------- */

function ShowLanguage(country, id) {
	if((country == 46) || (country == 47) || (country == 48) || (country == 49) || (country == 50) || (country == 51) || (country == 52)) {
		document.getElementById(id).style.display = 'inline';
		document.getElementById('note').value = 'English language only please';		
	} else {
		document.getElementById(id).style.display = 'none';
		document.getElementById('note').value = 'English language only please';
	}
}

/* -------------------------------------------------------------------------------------------------------------- */

function ShowLanguageNote(language, id, note) {
	if(language == 'english') {
			document.getElementById(id).value = 'English language only please';
	} else if(language == 'arabic') {
		if(note == 'English language only please')
		{
			document.getElementById(id).value = 'Arabic language only please';
		} else {
			document.getElementById(id).value = note;
		}
	}
}

/* -------------------------------------------------------------------------------------------------------------- */

function ShowDownloadButton(element, id) {
	if(document.getElementById(element).checked == true)
	{
		document.getElementById(id).style.display = 'inline';
	} else {
		document.getElementById(id).style.display = 'none';
	}
}

/* -------------------------------------------------------------------------------------------------------------- */

function ShowProgressBar(id) {
		document.getElementById(id).style.display = 'inline';
		document.getElementById("darkBackgroundLayer").style.display = "";
}

/* -------------------------------------------------------------------------------------------------------------- */

function RefreshParent()
{
window.parent.location.href = window.parent.location.href;
}

/* -------------------------------------------------------------------------------------------------------------- */

function confirmDelete(msg)
{
    return confirm(msg);
}

/* -------------------------------------------------------------------------------------------------------------- */

function clearInput(id)
{
	if (document.getElementById(id).value == document.getElementById(id).value) {
	document.getElementById(id).value = "" ;
	}
}

/* -------------------------------------------------------------------------------------------------------------- */

function MM_CheckFlashVersion(reqVerStr,msg){
  with(navigator){
    var isIE  = (appVersion.indexOf("MSIE") != -1 && userAgent.indexOf("Opera") == -1);
    var isWin = (appVersion.toLowerCase().indexOf("win") != -1);
    if (!isIE || !isWin){  
      var flashVer = -1;
      if (plugins && plugins.length > 0){
        var desc = plugins["Shockwave Flash"] ? plugins["Shockwave Flash"].description : "";
        desc = plugins["Shockwave Flash 2.0"] ? plugins["Shockwave Flash 2.0"].description : desc;
        if (desc == "") flashVer = -1;
        else{
          var descArr = desc.split(" ");
          var tempArrMajor = descArr[2].split(".");
          var verMajor = tempArrMajor[0];
          var tempArrMinor = (descArr[3] != "") ? descArr[3].split("r") : descArr[4].split("r");
          var verMinor = (tempArrMinor[1] > 0) ? tempArrMinor[1] : 0;
          flashVer =  parseFloat(verMajor + "." + verMinor);
        }
      }
      // WebTV has Flash Player 4 or lower -- too low for video
      else if (userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 4.0;

      var verArr = reqVerStr.split(",");
      var reqVer = parseFloat(verArr[0] + "." + verArr[2]);
  
      if (flashVer < reqVer){
        if (confirm(msg))
          window.location = "http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";
      }
    }
  } 
}

  /* -------------------------------------------------------------------------------------------------------------- */