Feeding the values into the javascript is trivial - for example:
PHP Code:
var mygallery=new fadeSlideShow({
wrapperid: "fadeshow1", //ID of blank DIV on page to house Slideshow
dimensions: [250, 180], //width/height of gallery in pixels. Should reflect dimensions of largest image
imagearray: [
["includes/templates/your_template/images/yourimage0.jpg", "", "", "<?php echo FADESHOWTEXT_1_IMG00;?>"],
["includes/templates/your_template/images/yourimage1.jpg", "", "", "<?php echo FADESHOWTEXT_1_IMG01;?>"],
["includes/templates/your_template/images/yourimage2.jpg", "http://some-url.com", "_new", "<?php echo FADESHOWTEXT_1_IMG02;?>"],
FADESHOWTEXT_1_IMG00 is a constant set in a language define file. A variable would be echoed in the same way. By the time the javascript runs, all it knows is that there is text in the array (or a link or product id, etc.)
I would first do a debug echo of the variable you want to use, to see if it passes a correct value at execution (look at view source if the page doesn't finish loading). If it doesn't work, then you need to find the info another way. For the product info page, the product id will be passed in $_GET['products_id'] even if it is not yet available in $products_id. From that, you can use a ZC lookup function to get other info about the product. For the shopping cart, a lot of info is held in (I think) the cart object... I would have to research exactly how to access it. Someone else will probably have that ready to hand.