
// zoom viewer arguments
// Server is defined in the config.js file

S7Config.isViewerRoot	= "http://s7d5.scene7.com/is-viewers/";
S7Config.isRoot			= "http://s7d5.scene7.com/is/image/";
S7Config.contentRoot 	= "http://s7d5.scene7.com/";
S7Config.skinsRoot 		= "http://s7d5.scene7.com/skins/";

var serverUrl = S7Config.isRoot;  //declares the server root for all image serving related calls.  Be sure to change this to the appropriately assigned domain before going live!
var contentRootUrl = S7Config.contentRoot + "skins/";  //Same as above but appending the skin context
var viewerUrl = S7Config.isViewerRoot +'/flash/genericzoom.swf'; //same as above but referencing is-viewers for viewer context

var configName = 'Circumerro/RenderSetConfigDefaults'; //This variable tells the viewer to pull configuration information associated to an IPS ID, uses same notation as above
var args;

function showViewer (into,imageName)
{
	// var imageName = 'Circumerro/FS09-101-1001,Circumerro/FS09-101-1002,Circumerro/FS09-101-1003,Circumerro/FS09-101-1004,Circumerro/FS09-101__altview'; //This variable tells the viewer what image to load, reference using <company name>/<IPS ID of asset>
	
	// build url - this section concatonates a variable to pass to the viewer containing all the information it needs to initialize.  If adding any other parameters reference them here
		args = 'serverUrl='+serverUrl;
		args += '&image='+imageName;
		args += '&contentRoot='+contentRootUrl;
		args += '&instancename=productZoom';
		args += '&viewSize=425,425';
		args += '&skin='+ encodeURI('http://s7d5.scene7.com/skins/Circumerro/SWFs/scene7_basicView.swf');
		//	args += '&zoomCursor='+ encodeURI('http://s7d2.scene7.com/skins/Cloudveil/SWFs/zoomCursor.swf');
		args += '&zoomStep=1';
		args += '&modifier='+ encodeURI('op_sharpen=1&resMode=sharp2&op_usm=1.0,1.0,8,0');
		// args += '&config='+configName+';'

	
	if (flashOk(8,0,0)) {

		/*
		var code = ''+
				'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" width="425" height="425" id="productZoom">'+
				' <param name="movie" value="' + viewerUrl + '"/>'+
				' <PARAM NAME=menu VALUE=false><PARAM NAME=scale VALUE=noscale> <PARAM NAME=salign VALUE=LT>'+
				' <param name="quality" value="high" />'+
				' <param name="play" value="true">' +
				' <param name="WMode" value="Transparent">' +
				' <embed src="' + viewerUrl + '" swliveconnect="true" name="productZoom" '+
				' quality="high" SWLIVECONNECT="true"'+
				' width="425" '+
				' height="425" '+
				' border="0" wmode="transparent" '+
				' type="application/x-shockwave-flash" '+
				' flashvars="'+ args +'" '+
				' pluginspage="http://www.adobe.com/go/getflashplayer" />'+
				'</object>'+
				'';
		$(into).update(code);
		*/
		var FO_1 = {
				movie:viewerUrl +'?'+ args,id:'productZoom',name:'productZoom',width:"425",height:"425",majorversion:"8",build:"0",allowscriptaccess:'always',bgcolor:"#FFFFFF",
				swliveconnect:'true',scale:'noscale',play:'true',wmode:'transparent'
			//	flashvars:args
			 };
			UFO.create(	FO_1, into);
	} else {
		$('prod_img_0').addClassName('on');
		$('zoom_controls').hide();
	}
	switchImg(0);
}



var prodImgOn = 0;

function switchImg (index) {
	// change scene7 image
	var current = 'img_icon_'+ prodImgOn;
	var newcurr = 'img_icon_'+ index;
	if (index != prodImgOn) {
		if ($(newcurr)) {
			$(current).removeClassName('on');
			$(newcurr).addClassName('on');
			if (flashOk(8,0,0)) {
				S7Config.setFlashParam('productZoom','currentFrame',index);
			} else {
				// no flash version
				$('prod_img_'+ index).addClassName('on');
				$('prod_img_'+ prodImgOn).removeClassName('on');
			}
			prodImgOn = index;
		}
	}
	 var viewLabels = $(newcurr).getElementsByTagName('label');
	 var viewName = '';
	 if (viewLabels.length == 1) {
	 viewName = viewLabels[0].innerHTML;
	 }
	 if (viewName != '') {
	 $('on_view_name').update(viewName);
	 $('on_view').setStyle({visibility:'visible'});
	 } else {
	 $('on_view').setStyle({visibility:'hidden'});
	 }
}

function zoomIn () {
	S7Config.setFlashParam('productZoom','rgnr','0,0,1.5');
}
function zoomOut () {
	S7Config.setFlashParam('productZoom','rgnr','0,0,.5');
}
function zoomReset () {
	S7Config.setFlashParam('productZoom','rgnr','0,0,0');
}
