// JavaScript Document 040311 6:30pm

var i, inxt, p, theImages = new Array(), whichImage, rimage, nxtImage = new Image(), ldngImages=0, d=document, obj, scrh, scrw, gwin = null, path;

function popwin(wdt,hgt,pad,content,wintype) {
	
	if (wintype == 'doc') {
		wdt = 840;
		hgt = 575;
	}
	
	if (wintype == 'txt') {
		wdt = document.getElementById(content).scrollWidth;if (wdt > 525) {wdt = 525;};
		hgt = document.getElementById(content).scrollHeight;if (hgt > 575) {hgt = 575;};
	}
	
	var params = wdt + "XZX" + hgt + "XZX" + pad + "XZX" + content + "XZX" + wintype; /* XZX is delimiter for calling parameters to be passed to vpop in window NAME */
	if (gwin && wintype!='mfi') {gwin.close();} /* close a pop-up if one is open (see note for case ext below) */
	wdt = wdt + (2*pad);
	var result = null;
	var ref = null;
	/* add height room for button(s) */
		switch (wintype) {
			case 'gal': result = 25; break;
			case 'img': result = 25; break;
			case 'txt': result = 25; break;
			case 'mfi': result = 25; break;
			case 'map': result = 25; break;
			case 'doc': result = 25; break;
			default: result = 0;
		}
	hgt = hgt + (2*pad) + result;
	scrh = ((window.screen.height - hgt)/2);
	scrw = (((window.screen.width - wdt)/2) - 16);
	
		switch (wintype) {
			case 'pdf': gwin = window.open(content + '.pdf',content,'width=' + wdt + 'px,height=' + hgt + 'px' + ',left=' + scrw + ',top=' + scrh + ',resizable=yes,scrollbars=yes'); gwin.focus();break;
			case 'ext': /* NB: IE will not return a window reference/handle (gwin) to external site (e.g. virtuesshop) - so cannot focus or close these windows - they will be left open until closed by the IE user. Also note that external links windows from a pop-up has no handle, so will be left open by all browsers.
For full window controls, specify:  gwin = window.open(ref,content,'width=' + wdt + 'px,height=' + hgt + 'px' + ',left=' + scrw + ',top=' + scrh + ',directories=yes,location=yes,menubar=yes,scrollbars=yes,status=yes,toolbar=yes,resizable=yes');}  */
			
if (content == "buycards") {
ref = encodeURI("https://virtuesshop.com/index.php?option=com_virtuemart&page=shop.product_details&flypage=flypage.tpl&product_id=45&Itemid=53"); }
if (content == "buypog") {
ref = encodeURI("https://virtuesshop.com/index.php?page=shop.product_details&flypage=flypage.tpl&product_id=117&category_id=1&option=com_virtuemart&Itemid=61"); }
if (content == "buyevg") {
ref = encodeURI("https://virtuesshop.com/index.php?page=shop.product_details&flypage=flypage.tpl&product_id=96&category_id=17&option=com_virtuemart&Itemid=98"); }
if (content == "buyilb") {
ref = encodeURI("https://virtuesshop.com/index.php?page=shop.product_details&flypage=flypage.tpl&product_id=104&category_id=3&keyword=booklet&option=com_virtuemart&Itemid=64"); }
if (content == "buyFVG") {
ref = encodeURI("https://virtuesshop.com/index.php?page=shop.product_details&flypage=flypage.tpl&product_id=26&category_id=2&option=com_virtuemart&Itemid=63"); }
if (content == "buy5strat") {
ref = encodeURI("https://virtuesshop.com/index.php?page=shop.product_details&flypage=flypage.tpl&product_id=123&category_id=8&option=com_virtuemart&Itemid=67"); }
if (content == "buyVAC") {
ref = encodeURI("https://virtuesshop.com/index.php?page=shop.product_details&flypage=flypage.tpl&product_id=86&category_id=10&option=com_virtuemart&Itemid=55"); }
if (content == "buySM") {
ref = encodeURI("https://virtuesshop.com/index.php?page=shop.product_details&flypage=flypage.tpl&product_id=41&category_id=1&option=com_virtuemart&Itemid=61"); }
if (content == "buyFVC") {
ref = encodeURI("https://virtuesshop.com/index.php?page=shop.product_details&flypage=flypage.tpl&product_id=27&category_id=10&option=com_virtuemart&Itemid=55"); }
if (content == "buyCbag") {
ref = encodeURI("https://virtuesshop.com/index.php?page=shop.product_details&flypage=flypage.tpl&product_id=46&category_id=1&option=com_virtuemart&Itemid=61"); }
if (content == "buyGcards") {
ref = encodeURI("https://virtuesshop.com/index.php?page=shop.product_details&flypage=flypage.tpl&product_id=48&category_id=1&keyword=greeting+card&option=com_virtuemart&Itemid=61"); }
if (content == "buyFP") {
ref = encodeURI("https://virtuesshop.com/index.php?page=shop.product_details&flypage=flypage.tpl&product_id=118&category_id=8&option=com_virtuemart&Itemid=67"); }
if (content == "buyFC") {
ref = encodeURI("https://virtuesshop.com/index.php?option=com_virtuemart&Itemid=90"); }
if (content == "buyCfriendsCD") {
ref = encodeURI("https://virtuesshop.com/index.php?page=shop.product_details&flypage=flypage.tpl&product_id=51&category_id=1&keyword=circle+of+friends&option=com_virtuemart&Itemid=61"); }
if (content == "buyPOGvslCD") {
ref = encodeURI("https://virtuesshop.com/index.php?page=shop.product_details&flypage=flypage.tpl&product_id=57&category_id=12&option=com_virtuemart&Itemid=57"); }
if (content == "buyPOGCD") {
ref = encodeURI("https://virtuesshop.com/index.php?page=shop.product_details&flypage=flypage.tpl&product_id=56&category_id=12&option=com_virtuemart&Itemid=57"); }
if (content == "buyDPfruits") {
ref = encodeURI("https://virtuesshop.com/index.php?page=shop.product_details&flypage=flypage.tpl&product_id=37&category_id=12&option=com_virtuemart&Itemid=57"); }
if (content == "buyDPpphs") {
ref = encodeURI("https://virtuesshop.com/index.php?page=shop.product_details&flypage=flypage.tpl&product_id=59&category_id=12&option=com_virtuemart&Itemid=57"); }
if (content == "buyDPsfl") {
ref = encodeURI("https://virtuesshop.com/index.php?page=shop.product_details&flypage=flypage.tpl&product_id=58&category_id=12&option=com_virtuemart&Itemid=57"); }
if (content == "buyDPconference") {
ref = encodeURI("https://virtuesshop.com/index.php?page=shop.product_details&flypage=flypage.tpl&product_id=71&category_id=12&option=com_virtuemart&Itemid=57"); }
if (content == "buySHOP") {
ref = encodeURI("http://www.virtuesshop.com"); }
if (content == "TCarticle") {
ref = encodeURI("tc_article.htm"); }
if (content == "LKPbio") {
ref = encodeURI("lkp_bio.htm"); }
if (content == "PRplume") {
ref = encodeURI("press_release.htm"); }
if (content == "TRposter") {
ref = encodeURI("ten_rules_poster.htm"); }
if (content == "searchvp") {
var stext = d.getElementById("srchtxt").value;
if (stext == "") {return;}
ref = encodeURI("http://www.google.com/search?q=" + stext + "&sitesearch=virtuesproject.com/&as_qdr=m3"); }

gwin = window.open(ref,content,'height='+hgt+',width='+wdt+',location=yes,menubar=yes,scrollbars=yes,toolbar=yes,titlebar=yes,resizable=yes,screenX='+scrw+',screenY='+scrh+',top='+scrh+',left='+scrw+'');

			return; break;

			default: gwin = window.open('virtuespopup.html',params,'width=' + wdt + 'px,height=' + hgt + 'px' + ',left=' + scrw + ',top=' + scrh + ',resizable=yes,scrollbars=yes');gwin.focus();
		} /*end wintype*/
} /*end popwin*/

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
