/*
	// ------------------------------------------------------------------------------------------------- >>>>>>>>>>
	// 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 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 ClipBoard(mytext)
{
	if (window.clipboardData)
	{
		window.clipboardData.setData("Text", mytext);
	} else if (window.netscape)  { 
		netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');

		var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
		if (!clip) return;

		var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
		if (!trans) return;   

		trans.addDataFlavor('text/unicode');

		var str = new Object();
		var len = new Object();
		var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
		var copytext=mytext;
		str.data=copytext;
		trans.setTransferData("text/unicode",str,copytext.length*2);
		var clipid=Components.interfaces.nsIClipboard;
		if (!clip) return false;
		clip.setData(trans,null,clipid.kGlobalClipboard);
	}
	/* alert("Following info was copied to your clipboard:\n\n" + mytext); */
	return false;
}

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

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

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