
function FindFlyer(xPos,yPos) {

//	new Effect.toggle($('flyerfinder'), 'slide');

	var state = document.getElementById('flyerfinder').style.display;

	if (state == "block") {
		$('flyerfinder').setStyle({display: 'none'});
		//document.getElementById('flyerfinder').style.display = 'none';
	} else {
		/*document.getElementById('flyerfinder').style.left = xPos;
		document.getElementById('flyerfinder').style.bottom = yPos;
		document.getElementById('flyerfinder').style.display = 'block';*/
		
		$('flyerfinder').setStyle({display: 'block', left: xPos+'px', bottom: yPos+'px'});
	}

}

function ExpandThumbs(lang) {

	new Effect.toggle($('morethumbs'),'blind');

	if (lang == "en") {
		var strView = "View all items";
		var strClose = "Close";
	} else {
		var strView = "Visionnez tous les articles";
		var strClose = "Fermez";
	}

	if ($('morethumbs').visible()) {
		document.getElementById('expandLink').innerHTML = strView;
	} else {
		document.getElementById('expandLink').innerHTML = strClose;
	}

}

function popUp(sURL, theWidth, theHeight) { 

    //    Gets screen size

    var iPageWidth, iPageHeight;

    if (self.innerHeight) {

        iPageWidth = self.innerWidth;

        iPageHeight = self.innerHeight;

    }

    else if (document.all && document.getElementById) {

        iPageWidth = screen.availWidth;

        iPageHeight = screen.availHeight;

    }

    else if (document.body) {

        iPageWidth = document.body.clientWidth;

        iPageHeight = document.body.clientHeight;

    }

    leftSideOfPopup = (iPageWidth - theWidth)/2;

    topSideOfPopup = (iPageHeight - theHeight)/2;

    features = "toolbar=0,width=" + theWidth + ",height=" + theHeight + ",status=0,scrollbars=0,resize=0,menubar=0,location=0,directories=0,screenX=" + leftSideOfPopup + ",left=" + leftSideOfPopup + ",screenY=" + topSideOfPopup + ",top=" + topSideOfPopup;    <!-- One line and no spaces  -->

    theWindow = window.open(sURL, "", features);

    document.getElementById('sotester').style.display = 'block';

}


function switchProductView(pv_id){
	var primaryView = document.getElementById('item_content');
	var view = document.getElementById('view_'+pv_id);
	if(primaryView && view){
		primaryView.style.backgroundImage = 'url(' + view.href + ')';
	}
	return false;
}

function showEmailForm(lang, code){
	window.open('/flyer/share/index.php?lang='+encodeURIComponent(lang)+'&code='+encodeURIComponent(code),'shareform','status=0,toolbar=0,menubar=0,resize=0,scrollbars=0,location=0,directories=0,height=400,width=300');
	return false;
}

function popUpPromotion(page) {	
	var nXpos = (screen.availWidth - 730) / 2;
	var nYpos = (screen.availHeight - 560) / 2;
	var nWidth = 800;
	var nHeight = 600;

	if (page == "en") {
		popupWin = window.open('/availability_locator/en/', 'en', 'scrollbars=1,resizable=0,width=' + nWidth + ',height=' + nHeight + ',left=' + nXpos + ',top=' + nYpos);
	} else if (page == "fr") {
		popupWin = window.open('/availability_locator/fr/', 'fr', 'scrollbars=1,resizable=0,width=' + nWidth + ',height=' + nHeight + ',left=' + nXpos + ',top=' + nYpos);
	}
}