/** 
 * @fileoverview This page is used for loading product details through ajax
*/

/**
 * Select the current product and load the current product details
 * @throws Shows the current product details
 */
/** 
 * vMenu is used for menu index 
 * @type string
 * pmId is used for selected menu index 
 * @type int
 * pmMenuCount is used for total menu count 
 * @type int
 * vIndex is used for looping 
 * @type int
 * vUrl is used for ajax product page path
 * @type string
 */

var vMenu=0;
function loadprodactdata(pmId,pmMenuCount)
{
	if(document.getElementById('menu_'+pmId).className=='cartMenuItemSelected1')
	return false;
	for(vIndex=0;vIndex<pmMenuCount;vIndex++)
	{
		vMenu 		=	'menu_'+vIndex;
		document.getElementById(vMenu).className='cartMenuItems1';
	}
	vMenu 		=	'menu_'+pmId;
	document.getElementById(vMenu).className='cartMenuItemSelected1';
	vUrl="comp/cmp_products/web/samplebook_ajax.php?id="+pmId+"&randno="+Math.floor(Math.random()*100);
	document.getElementById("loadinnerpage").innerHTML="<table align='left' width='100'><tr><td></td></tr><tr><td><span class='loading'>Loading...</span></td><tr></table>";
		ajaxrequest(vUrl,"displayProductPage",document.getElementById("loadinnerpage"),0);
}
/**
 * Get the product details from Ajax Request and assign the value to Div .Loading the slideshow details
 */
/** 
 * aContent is used for split the contewnt as product details and slideshow details
 * @type array
 * aSlideImageName is used for storing the slide show image name 
 * @type array
 * txt is used recieving content from ajax request
 * @type string
 * aSlideImagePath is used for storing image path 
 * @type string
 * vSlidshow is used for slideshow div content
 * @type string
 * obj is used for div object
 * @type object

 */
function displayProductPage(txt,obj)
{
		var aContent = new Array();
		var aSlideImageName = new Array();
		var aSlideImagePath;
		aContent = txt.split("[#slideshow#]");
		obj.innerHTML = aContent[0];
		//obj.style.height = document.getElementById("input1").offsetHeight;
		if(aContent.length > 1)
			aSlideImageName	= aContent[1].split(",");
		if(aContent.length > 2)
			aSlideImagePath	= aContent[2];
		var vSlidshow = '<div style=" width:775px; height:500px;">';
		vSlidshow += '<div style="width:750px; height:480px; margin-left:10px; margin-top:10px">';
		vSlidshow += '<div style="float:left"><a href="javascript:move()" id="prev" style="visibility:hidden">';
		vSlidshow += '<img src="dualweb/products/images/icon_previous.gif" alt="" border="0" /></a></div>';
		vSlidshow += '<div style="float:right;"><a href="javascript:move()" id="next" style="visibility:hidden">';
		vSlidshow += '<img src="dualweb/products/images/icon_next.gif" alt="" border="0" /></a></div>';
		vSlidshow += '<div >';
		vSlidshow += '<div style="margin: auto; width: 100%; float: left;" align="center">';
		vSlidshow += '<div  id="up" class="pics" align="center">';	
		for(Index=0;Index<aSlideImageName.length;Index++)
		{
			vSlidshow += '<img src="'+aSlideImagePath+aSlideImageName[Index]+'"/>';
		}
		vSlidshow += '</div>';
		vSlidshow += '</div>';
		vSlidshow += '<div>';
		vSlidshow += '<div id="output" class="textGreyNormal" style="float:left;"></div>';
		vSlidshow += '<div style="float:right"><a id="popupContactClose" href="javascript:stop()">';
		vSlidshow += '<img src="dualweb/products/images/icon_close.gif" alt="" border="0" /></a></div>';			
		vSlidshow += '<div style="float:right; margin:0 4px;"><a href="javascript:pause()" id="pause" style="display:none">';
		vSlidshow += '<img id="imgpause" src="dualweb/products/images/icon_pause.gif" alt="" border="0" /></a>';
		vSlidshow += '<a href="javascript:play()" id="play" style="display:none">';
		vSlidshow += '<img id="imgplay" src="dualweb/products/images/icon_play.gif" alt="" border="0" /></a></div>';
		vSlidshow += '</div>';
		vSlidshow += '</div>';
		vSlidshow += '<div align="left"></div><div id="shadowRight"></div>';
		vSlidshow += '</div>';
		vSlidshow += '</div>';
		document.getElementById("hidTemp").value = vSlidshow;
	
}
