var urlAppender = '';
var shoppingPopupFlag = true;
var curtop;
var curleft;
var imagePath;
function showWaitImage()
{
	document.getElementById("divAjaxCall").style.display = "block";
	window.scroll(0,0);
}
function hideWaitImage()
{
	document.getElementById("divAjaxCall").style.display = "none";
}
function findPos(obj) {
	//var obj = document.getElementById('trproducttabs');
	if (obj.offsetParent) {
		curleft = obj.offsetLeft;
		curtop = obj.offsetTop;
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		}
	}
	return [curleft,curtop];
}

function initialize() {
  // initialize the DHTML History
  // framework
  dhtmlHistory.initialize();
  // subscribe to DHTML history change
  dhtmlHistory.addListener(historyChange);
  // if this is the first time we have
  // loaded the page...
}

function historyChange(newLocation, historyData) {
  if(historyData != null && newLocation != '')
  {
	  if(newLocation.indexOf('CategoryID') != -1)
	    getMainCategoryID(historyData,-1);
	  else
	  if(newLocation.indexOf('Product') != -1)
	  	getMainAndParentCategoryID(historyData,'product');
	  else
	  if(newLocation.indexOf('Pricing') != -1)
	  	getMainAndParentCategoryID(historyData,'pricing');	
	  else
	  if(newLocation.indexOf('RelatedItem') != -1)
	  	getRelatedProducts(historyData);
	  else
	  if(newLocation.indexOf('HolidayCatID') != -1)
	  	getHolidayPage(historyData);
	  else
	  if(newLocation.indexOf('ConfigPage') != -1)
	  	getMainAndParentCategoryID(historyData,'configuration');
	  else
	  if(newLocation.indexOf('ShoppingCart') != -1)
	  	shoppingCart();		
	  else
	  if(newLocation.indexOf('Comparison') != -1)
	   	fetchComparisonDetails(historyData);
	  else
	  if(newLocation.indexOf('CloseOutSales') != -1)
	   	getCloseOutdata(historyData);
	  else
	  if(newLocation.indexOf('Press') != -1)
	   	pressPage(historyData);
	  else
	  if(newLocation.indexOf('FeedbackPage') != -1)
	   	feedbackFrm(historyData);
	  else
	  if(newLocation.indexOf('Pages') != -1)
	   	staticPage(historyData); 	
	  if(newLocation.indexOf('home') != -1)
	  	getHomePage('false');
	  else
	  if(newLocation.indexOf('AccessoriesPage') != -1)
	  {
	  	getCategorySortedAttribute(historyData,0,0,'true');
	  	getAccessoriesPage(historyData);
	  }
	  else
	  if(newLocation.indexOf('GiftCard') != -1)
	  {
	  	getGiftItemPage();
	  }	
	  else
	  if(newLocation.indexOf('AffiliateSalesStatic') != -1)
	  {
	  	getAffiliateSalesStatic();
	  }
	  else
	  if(newLocation.indexOf('GizminePage') != -1)
	  {
	  	showGizmineProduct();
	  }	
  }  	
}
function compareProducts(size)
{
	var ctrl = "chk";
	var id ="";
	var arrProductID = new Array();
	var strProductID='';
	var flag = false;
	for ( var i =0; i< size ;i++)
	{
	 	ctrl = "chk"+i;
	 	if (document.getElementById(ctrl).checked ==true)
	 	{
	 		if ( size >1)
	 		{
	 			id += document.getElementById(ctrl).value +",";
	 		
	 		}
	 		else
	 		{
	 			id = document.getElementById(ctrl).value ;
	 		}
	 		flag=true;
	 		
	 	}
	}
	
	strProductID = id;
	if (flag==true)
	{
		arrProductID = strProductID.split(',');
		if( arrProductID.length==2 )
		{
			document.all('trAlertMessage').style.display='block';
			document.all('lblAlertMessage').innerHTML = document.getElementById('hidden_atleast_two_products').value;
			return false;
		}
		else if (arrProductID.length>4)
		{
			document.all('trAlertMessage').style.display='block';
			document.all('lblAlertMessage').innerHTML = document.getElementById('hidden_more_than_three').value;
			return false;
		}
		document.all('trAlertMessage').style.display='none';
		if ( AjaxToggle == 'true')
		{
			fetchComparisonDetails(id);
		}
		else
		{
			window.location.href = strSiteUrl + urlAppender +'/'+id+'/comparison.shtml';
		}
	}
}

function fetchComparisonDetails(id)
{
	var xmlHttp;
	var randomNumber = Math.random();
	var url= urlAppender + '/comparision.do?ProductID='+id+'&RandomNumber='+randomNumber;//dirPath+
	showWaitImage();
	try
		{
		//Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
	catch (e)
		{		
		//Internate Explorer
		try
		  {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		catch (e)
			{
			try
		 	{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		 	}
			catch (e)
			{
			alert("Your browser does not support AJAX!");
			return false;
			}
	  	}
	}
	xmlHttp.onreadystatechange=function()
	{
  	if(xmlHttp.readyState==4)
		{
		if (xmlHttp.status ==200)
			{	
				document.all('dvMain').style.display = 'block';
				
				document.all('dvLeftMenu').innerHTML = '';
				document.all('dvProductCenter').innerHTML = '';
				document.all('dvProductMain').style.display = 'none';
				document.all('dvMain').innerHTML = xmlHttp.responseText;
				
				if(AjaxToggle == 'true')
				{
					dhtmlHistory.add("Comparison="+id, id);
				}
				document.title = 'Dynamism';
				hideWaitImage();
			}
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

//To get MainCategoryID
function getMainCategoryID(parentCategoryID, productURLCode)
{
	var xmlHttp;
	var randomNumber=Math.random();
	var url= urlAppender + '/getMainCategoryID.do?reqCode=getMainCategoryID&parentCategoryID='+parentCategoryID+'&RandomNumber='+randomNumber;//dirPath+
	showWaitImage();
	try
		{
		//Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
	catch (e)
		{		
		//Internate Explorer
		try
		  {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		catch (e)
			{
			try
		 	{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		 	}
			catch (e)
			{
			alert("Your browser does not support AJAX!");
			return false;
			}
	  	}
	}
	xmlHttp.onreadystatechange=function()
	{
  	if(xmlHttp.readyState==4)
		{
		if (xmlHttp.status ==200)
			{	
				var mainCategoryID = xmlHttp.responseText;
				if (productURLCode == '0')
				{
					getCategoryData(mainCategoryID);
					getCategorySortedAttribute(mainCategoryID, 0, productURLCode,'false');
				}
				else if(productURLCode == '-1')
				{
					if(mainCategoryID == 1)
					{
						getCategoryData(parentCategoryID);
						getCategorySortedAttribute(parentCategoryID, 0, '0', 'false');
					}
					else if(mainCategoryID != '')
					{
						getCategoryData(parentCategoryID);
						getCategorySortedAttribute(mainCategoryID, parentCategoryID, '0', 'false');
					}
					else
					{	
						showErrorPage();
					}
				}
				else
				{
					getCategorySortedAttribute(mainCategoryID, parentCategoryID, productURLCode, 'false');
				}
				hideWaitImage();
			}
		}
	}
	xmlHttp.open("POST",url,true);//GET
	xmlHttp.send(null);
}
//To get MainCategoryID
function getMainCategoryID_ForCategory(parentCategoryID, productURLCode)
{
	var xmlHttp;
	var randomNumber=Math.random();
	var url= urlAppender + '/getMainCategoryID.do?reqCode=getMainCategoryID&parentCategoryID='+parentCategoryID+'&RandomNumber='+randomNumber;//dirPath+
	showWaitImage();
	try
		{
		//Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
	catch (e)
		{		
		//Internate Explorer
		try
		  {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		catch (e)
			{
			try
		 	{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		 	}
			catch (e)
			{
			alert("Your browser does not support AJAX!");
			return false;
			}
	  	}
	}
	xmlHttp.onreadystatechange=function()
	{
  	if(xmlHttp.readyState==4)
		{
		if (xmlHttp.status ==200)
			{	
				var mainCategoryID = xmlHttp.responseText;
				if(mainCategoryID == 1)
				{
					getCategorySortedAttribute(parentCategoryID, 0, '0', 'false');
				}
				else if(mainCategoryID != '')
				{
					getCategorySortedAttribute(mainCategoryID, parentCategoryID, '0', 'false');
				}
				else
				{	
					showErrorPage();
				}
				hideWaitImage();
			}
		}
	}
	xmlHttp.open("POST",url,true);//GET
	xmlHttp.send(null);
}
//To get Main & Parent Category ID
function getMainAndParentCategoryID(productURLCode, pageType)
{
	var xmlHttp;
	var randomNumber=Math.random();
	var url= urlAppender + '/getMainCategoryID.do?reqCode=getMainAndParentCategoryID&productURLCode='+productURLCode+'&RandomNumber='+randomNumber;//dirPath+
	showWaitImage();
	try
		{
		//Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
	catch (e)
		{		
		//Internate Explorer
		try
		  {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		catch (e)
			{
			try
		 	{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		 	}
			catch (e)
			{
			alert("Your browser does not support AJAX!");
			return false;
			}
	  	}
	}
	xmlHttp.onreadystatechange=function()
	{
  	if(xmlHttp.readyState==4)
		{
		if (xmlHttp.status ==200)
			{	
				var strCategory = xmlHttp.responseText;
				if(strCategory == 'ShowHomePage')
				{
					getHomePage('false');
				}
				else if(strCategory == '')
				{
					showErrorPage();
				}
				else
				{	
					arrCategoryID = strCategory.split('~');
					getCategorySortedAttribute(arrCategoryID[0],arrCategoryID[1],productURLCode,'false');
					if(pageType == 'product')
					{
						getProductData(productURLCode,arrCategoryID[2]);
					}
					else if(pageType == 'pricing')
					{
						getProductPricingPage(productURLCode,arrCategoryID[2]);
					}
					else
					{
						getConfigData(productURLCode);			
					}	
				}
				hideWaitImage();
			}
		}
	}
	xmlHttp.open("POST",url,true);//GET
	xmlHttp.send(null);
}

//To get Main & Parent Category ID
function getMainAndParentCategoryID_ForProduct(productURLCode, pageType)
{
	var xmlHttp;
	var randomNumber=Math.random();
	var url= urlAppender + '/getMainCategoryID.do?reqCode=getMainAndParentCategoryID&productURLCode='+productURLCode+'&RandomNumber='+randomNumber;//dirPath+
	showWaitImage();
	try
		{
		//Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
	catch (e)
		{		
		//Internate Explorer
		try
		  {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		catch (e)
			{
			try
		 	{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		 	}
			catch (e)
			{
			alert("Your browser does not support AJAX!");
			return false;
			}
	  	}
	}
	xmlHttp.onreadystatechange=function()
	{
  	if(xmlHttp.readyState==4)
		{
		if (xmlHttp.status ==200)
			{	
				var strCategory = xmlHttp.responseText;
				if(strCategory == 'ShowHomePage')
				{
					getHomePage('false');
				}
				else if(strCategory == '')
				{
					showErrorPage();
				}
				else
				{	
					arrCategoryID = strCategory.split('~');
					getCategorySortedAttribute(arrCategoryID[0],arrCategoryID[1],productURLCode,'false');
//					if(pageType == 'product')
//					{
//						getProductData(productURLCode,arrCategoryID[2]);
//					}
//					else if(pageType == 'pricing')
//					{
//						getProductPricingPage(productURLCode,arrCategoryID[2]);
//					}
//					else
//					{
//						getConfigData(productURLCode);			
//					}	
				}
				hideWaitImage();
			}
		}
	}
	xmlHttp.open("POST",url,true);//GET
	xmlHttp.send(null);
}

function getCategorySortedAttribute(mainCategoryID, parentCategoryID, productURLCode, accessoriesFlag)
{
	var categorySortedAttribute ='' ;
	var attributeID ='0';
	CreateLeftTree(mainCategoryID, parentCategoryID, productURLCode, categorySortedAttribute, attributeID, accessoriesFlag);
}


function CreateLeftTree(mainCategoryID, parentCategoryID, productURLCode, categorySortedAttribute, attributeID, accessoriesFlag)
{
	var randomNumber=Math.random();
	var strID = "";
	var strName = "";
	var menuArrayNameArr = menuArrayName.split('~~~');
	var menuArrayIDArr = menuArrayID.split('~~~');
	for(var i=0; i<menuArrayIDArr.length; i++)
	{
		strID = menuArrayIDArr[i];
		strName = menuArrayNameArr[i];
		var strID1 = menuArrayIDArr[i].split('@');
		var strName1 = menuArrayNameArr[i].split('@');
		if(mainCategoryID==strID1[0])
		{
			break;	
		}
	}
	var xmlHttp;
	var url= urlAppender + '/leftmenu.jsp?mainCategoryID='+mainCategoryID+'&parentCategoryID='+parentCategoryID+'&productURLCode='+productURLCode+'&RandomNumber='+randomNumber+'&CategorySortedAttribute='+categorySortedAttribute+'&AttributeID='+attributeID+'&AjaxToggle='+AjaxToggle+'&AccessoriesFlag='+accessoriesFlag;//dirPath+
	
	try
		{
		//Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
	catch (e)
		{		
		//Internate Explorer
		try
		  {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		catch (e)
			{
			try
		 	{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		 	}
			catch (e)
			{
			alert("Your browser does not support AJAX!");
			return false;
			}
	  	}
	}
	
	xmlHttp.onreadystatechange=function()
	{
  	if(xmlHttp.readyState==4)
		{
		if (xmlHttp.status ==200)
			{	
				document.all('dvMain').style.display='none';
				document.all('dvProductMain').style.display ='block';
				document.all('dvLeftMenu').innerHTML = xmlHttp.responseText;
			}
		}
	}
	xmlHttp.open("POST",url,true);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	for(var i=0;i<strName.length;i++){
		c = strName.charCodeAt(i);
		if(c>127){
			var re = new RegExp(strName.charAt(i));
			strName = strName.replace(re, "&#"+c+";");
		}
	}
	//xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8");
	//xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=ISO-8859-1");
	xmlHttp.setRequestHeader("menuArrayNameData", strName);
	xmlHttp.setRequestHeader("menuArrayID", strID);
	xmlHttp.send(null);
}
function getCategoryData(categoryID)
{
	var xmlHttp;
	var randomNumber=Math.random();
	
	var url= urlAppender + '/categoryPage.do?CategoryID='+categoryID+'&RandomNumber='+randomNumber+'&AjaxToggle='+AjaxToggle;//dirPath+
	showWaitImage();
	try
		{
		//Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
	catch (e)
		{		
		//Internate Explorer
		try
		  {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		catch (e)
			{
			try
		 	{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		 	}
			catch (e)
			{
			alert("Your browser does not support AJAX!");
			return false;
			}
	  	}
	}
	xmlHttp.onreadystatechange=function()
	{
  	if(xmlHttp.readyState==4)
		{
		if (xmlHttp.status ==200)
			{	
				document.all('dvMain').style.display='none';
				document.all('dvProductCenter').style.display = 'block';
				document.all('dvProductCenter').innerHTML = xmlHttp.responseText;
				if(AjaxToggle == 'true')
				{
					dhtmlHistory.add("CategoryID="+categoryID, categoryID);
				}
				document.title = 'Dynamism';
				hideWaitImage();
			}
		}
	}
	xmlHttp.open("POST",url,true);//GET
	xmlHttp.send(null);

}
function getAccessoriesPage(categoryID)
{
	var xmlHttp;
	var randomNumber=Math.random();
	var url= urlAppender + '/categoryPage.do?AccessoriesFlag=true&CategoryID='+categoryID+'&RandomNumber='+randomNumber+'&AjaxToggle='+AjaxToggle;//dirPath+
	showWaitImage();
	try
		{
		//Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
	catch (e)
		{		
		//Internate Explorer
		try
		  {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		catch (e)
			{
			try
		 	{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		 	}
			catch (e)
			{
			alert("Your browser does not support AJAX!");
			return false;
			}
	  	}
	}
	xmlHttp.onreadystatechange=function()
	{
  	if(xmlHttp.readyState==4)
		{
		if (xmlHttp.status ==200)
			{	
				document.all('dvMain').style.display='none';
				document.all('dvProductCenter').style.display = 'block';
				document.all('dvProductCenter').innerHTML = xmlHttp.responseText;
				if(AjaxToggle == 'true')
				{
					dhtmlHistory.add("AccessoriesPage="+categoryID, categoryID);
				}
				document.title = 'Dynamism - Accessories';
				hideWaitImage();
			}
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);

}
//For Product Page
function getProductData(productURLCode, productName123)
{
	var xmlHttp;
	var randomNumber=Math.random();
	
	var url= urlAppender + '/productPage.do?ProductURLCode='+productURLCode+'&RandomNumber='+randomNumber;//dirPath+
	showWaitImage();
	try
		{
		//Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
	catch (e)
		{		
		//Internate Explorer
		try
		  {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		catch (e)
			{
			try
		 	{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		 	}
			catch (e)
			{
			alert("Your browser does not support AJAX!");
			return false;
			}
	  	}
	}
	xmlHttp.onreadystatechange=function()
	{
  	if(xmlHttp.readyState==4)
		{
		if (xmlHttp.status ==200)
			{	
				
				document.all('dvProductMain').style.display ='block';
				document.all('dvProductCenter').style.display ='block';
				document.all('dvProductCenter').innerHTML  = xmlHttp.responseText;
				if(AjaxToggle == 'true')
				{
					dhtmlHistory.add("Product="+productURLCode, productURLCode);
				}
				if(productName123 != 'menuCall')
					document.title = 'Dynamism - '+productName123;
				hideWaitImage();	
			}
		}
	}
	xmlHttp.open("POST",url,true);//GET
	xmlHttp.send(null);
}
//For Product's Pricing Page
function getProductPricingPage(productURLCode, productName123)
{
	var xmlHttp;
	var randomNumber=Math.random();
	var url= urlAppender + '/productPage.do?ProductURLCode='+productURLCode+'&IsPricingPage=true&RandomNumber='+randomNumber;//dirPath+
	showWaitImage();
	try
		{
		//Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
	catch (e)
		{		
		//Internate Explorer
		try
		  {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		catch (e)
			{
			try
		 	{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		 	}
			catch (e)
			{
			alert("Your browser does not support AJAX!");
			return false;
			}
	  	}
	}
	xmlHttp.onreadystatechange=function()
	{
  	if(xmlHttp.readyState==4)
		{
		if (xmlHttp.status ==200)
			{	
				
				document.all('dvProductMain').style.display ='block';
				document.all('dvProductCenter').style.display ='block';
				document.all('dvProductCenter').innerHTML  = xmlHttp.responseText;
				if(AjaxToggle == 'true')
				{
					dhtmlHistory.add("Pricing="+productURLCode, productURLCode);
				}
				if(productName123 != 'menuCall')
					document.title = 'Dynamism - '+productName123;
				hideWaitImage();	
			}
		}
	}
	xmlHttp.open("POST",url,true);//GET
	xmlHttp.send(null);
}
function getConfigData(productURLCode)
{

	var xmlHttp;
	var randomNumber=Math.random();
	var url= urlAppender + '/config.do?ProductURLCode='+productURLCode+'&mode=new&RandomNumber='+randomNumber;//dirPath+
	showWaitImage();
	try
		{
		//Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
	catch (e)
		{		
		//Internate Explorer
		try
		  {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		catch (e)
			{
			try
		 	{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		 	}
			catch (e)
			{
			alert("Your browser does not support AJAX!");
			return false;
			}
	  	}
	}
	xmlHttp.onreadystatechange=function()
	{
  	if(xmlHttp.readyState==4)
		{
		if (xmlHttp.status ==200)
			{	
				document.all('dvMain').style.display = 'none';
				document.all('dvProductCenter').style.display = 'block';
				document.all('dvProductCenter').innerHTML = xmlHttp.responseText;
				if(AjaxToggle == 'true')
				{
					dhtmlHistory.add("ConfigPage="+productURLCode, productURLCode);
				}
				hideWaitImage();
			}
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);

}



function pressPage(id)
{

	var xmlHttp;
	var url= urlAppender + '/pressUIShow.do';//dirPath+
	showWaitImage();
	try
		{
		//Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
	catch (e)
		{		
		//Internate Explorer
		try
		  {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		catch (e)
			{
			try
		 	{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		 	}
			catch (e)
			{
			alert("Your browser does not support AJAX!");
			return false;
			}
	  	}
	}
	xmlHttp.onreadystatechange=function()
	{
  	if(xmlHttp.readyState==4)
		{
		if (xmlHttp.status ==200)
			{	
				document.all('dvMain').style.display = 'block';
				document.all('dvProductMain').style.display = 'none';
				document.all('dvProductCenter').innerHTML = "";
				document.all('dvLeftMenu').innerHTML = "";
				document.all('dvMain').innerHTML = xmlHttp.responseText;
				if(AjaxToggle == 'true')
				{
					dhtmlHistory.add("Press", id);
				}
				document.title = 'Dynamism';
				hideWaitImage();
			}
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);

}

function staticPage(id)
{

	var xmlHttp;
	var url= urlAppender + '/dynamismPage.do?rightMenuLinkID='+id;//dirPath+
	showWaitImage();
	try
		{
		//Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
	catch (e)
		{		
		//Internate Explorer
		try
		  {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		catch (e)
			{
			try
		 	{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		 	}
			catch (e)
			{
			alert("Your browser does not support AJAX!");
			return false;
			}
	  	}
	}
	xmlHttp.onreadystatechange=function()
	{
  	if(xmlHttp.readyState==4)
		{
		if (xmlHttp.status ==200)
			{	
				document.all('dvMain').style.display = 'block';
				document.all('dvProductMain').style.display = 'none';
				document.all('dvProductCenter').innerHTML = "";
				document.all('dvLeftMenu').innerHTML = "";
				document.all('dvMain').innerHTML = xmlHttp.responseText;
				if(AjaxToggle == 'true')
				{
					dhtmlHistory.add("Pages="+id, id);
				}
				document.title = 'Dynamism';
				hideWaitImage();
			}
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);

}

//To subscribe user for newsletter
function subscribeCustomer(methodType)
{  
	var xmlHttp;
	if(methodType == 'Right'){
	var email = document.all('txtEmailRight').value;
	} else {
	var email = document.all('txtEmail').value;
	}
	var subscribedForDailyNewsLetter = "N";
	if(!validateEmail(email))
	{
		if(methodType == 'Right'){
		document.getElementById('tdNewsletterMsgRight').style.display = 'block';
		document.getElementById('tdNewsletterMsgRight').innerHTML = document.getElementById('hnd.rightmenu.not_valid_email_address').value;
		}else{
		findPos(document.getElementById('tdHeadingNewsletterMsg'));
		document.getElementById('divNewsletterMsg').style.display = 'block';
		document.getElementById("divNewsletterMsg").style.left='600px';
		document.getElementById("divNewsletterMsg").style.top=(curtop+5)+'px';
		document.all('tdNewsletterMsg').innerHTML = document.getElementById('hnd.rightmenu.not_valid_email_address').value;
		}
		return false;
	}
	var randomNumber=Math.random();
	var url= urlAppender + '/subscriber.do?reqCode=addSubscriber&email='+email+'&subscribedForDailyNewsLetter='+subscribedForDailyNewsLetter+'&RandomNumber='+randomNumber;//dirPath+
	// showWaitImage();
	try
		{
		//Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
	catch (e)
		{		
		//Internate Explorer
		try
		  {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		catch (e)
			{
			try
		 	{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		 	}
			catch (e)
			{
			alert("Your browser does not support AJAX!");
			return false;
			}
	  	}
	}
	xmlHttp.onreadystatechange=function()
	{
  	if(xmlHttp.readyState==4)
		{
			if(xmlHttp.status ==200)
			{	
				
				if(methodType == 'Right'){
				document.getElementById('tdNewsletterMsgRight').style.display = 'block';
				document.getElementById('tdNewsletterMsgRight').innerHTML = xmlHttp.responseText;
				} else {
				findPos(document.getElementById('tdHeadingNewsletterMsg'));
				document.getElementById('divNewsletterMsg').style.display = 'block';
				document.getElementById("divNewsletterMsg").style.left='600px';
				document.getElementById("divNewsletterMsg").style.top=(curtop+5)+'px';
				document.getElementById('tdNewsletterMsg').innerHTML = xmlHttp.responseText;
				}
			}
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function removesubscribeCustomerPopup(){

	document.all('divNewsletterMsg').style.display = 'none';

}
/* form submit on enter key */
function  validateKeyCodeNewsletter(methodType)
{	
	
	if(BrowserDetect.browser=='Firefox'){
	if(document.implementation.createDocument) {
		document.onkeyup = function alertkey(e)
							{
								if(e.which==13){
									subscribeCustomer("TopMenu");
									return false;
							 	}		
							};
	 }	
	} else {
		if((event.charCode != null && event.charCode == 13)  || (event.keyCode != null && event.keyCode == 13 )){
			  subscribeCustomer("TopMenu");
			return false;
		}	
	}

}
/* form submit on enter key */
function  validateKeyCodeNewsletterRightLink()
{	
	
	if(BrowserDetect.browser=='Firefox'){
	if(document.implementation.createDocument) {
		document.onkeyup = function alertkey(e)
							{
								if(e.which==13){
									subscribeCustomer("Right");
									return false;
							 	}		
							};
	 }	
	} else {
		if((event.charCode != null && event.charCode == 13)  || (event.keyCode != null && event.keyCode == 13 )){
			  subscribeCustomer("Right");
			return false;
		}	
	}

}
function ajaxToggle()
{
	var xmlHttp;
	var randomNo = Math.random();
	var url= urlAppender + '/ajaxToggle.do?randomNumber='+randomNo;//dirPath+
	showWaitImage();
	try
		{
		//Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
	catch (e)
		{		
		//Internate Explorer
		try
		  {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		catch (e)
			{
			try
		 	{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		 	}
			catch (e)
			{
			alert("Your browser does not support AJAX!");
			return false;
			}
	  	}
	}
	xmlHttp.onreadystatechange=function()
	{
  	if(xmlHttp.readyState==4)
		{
		if (xmlHttp.status ==200)
			{	
				window.location.href= strSiteUrl + urlAppender + '/index.do';
				hideWaitImage();
			}
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function toggleAjaxButtonImg1(imagePath,ajaxToggle)
{
	
	if(ajaxToggle=="true")
	{
		document.getElementById("ajaxbutton").src = imagePath+"ajax_onh.gif";
	}else{
		document.getElementById("ajaxbutton").src = imagePath+"ajax_offh.gif";
	}
}
function toggleAjaxButtonImg2(imagePath,ajaxToggle)
{
	if(ajaxToggle=="true")
	{
		document.getElementById("ajaxbutton").src = imagePath+"ajax_on.gif";
	}else{
		document.getElementById("ajaxbutton").src = imagePath+"ajax_off.gif";
	}
}
function getCloseOutdata(categoryID)
{

	var xmlHttp;
	var url= urlAppender + '/closeout.do?CategoryID='+categoryID+'&AjaxToggle='+AjaxToggle;//dirPath+
	showWaitImage();
	try
		{
		//Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
	catch (e)
		{		
		//Internate Explorer
		try
		  {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		catch (e)
			{
			try
		 	{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		 	}
			catch (e)
			{
			alert("Your browser does not support AJAX!");
			return false;
			}
	  	}
	}
	xmlHttp.onreadystatechange=function()
	{
  	if(xmlHttp.readyState==4)
		{
		if (xmlHttp.status ==200)
			{	
				document.all('dvProductCenter').innerHTML = "";
				document.all('dvLeftMenu').innerHTML = "";
				document.all('dvProductMain').style.display = 'none';
				document.all('dvMain').style.display='block';
				document.all('dvMain').innerHTML = xmlHttp.responseText;
				if(AjaxToggle == 'true')
				{
					dhtmlHistory.add("CloseOutSales="+categoryID, categoryID);
				}
				document.title = 'Dynamism';
				hideWaitImage();
			}
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

//Function to get home Page
function getHomePage(homeFlag)
{
	var xmlHttp;
	var randomNumber=Math.random();
	var url= urlAppender + '/mainBody.do?RandomNumber='+randomNumber+'&AjaxToggle='+AjaxToggle;//dirPath+
	showWaitImage();
	try
		{
		//Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
	catch (e)
		{		
		//Internate Explorer
		try
		  {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		catch (e)
			{
			try
		 	{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		 	}
			catch (e)
			{
			alert("Your browser does not support AJAX!");
			return false;
			}
	  	}
	}
	xmlHttp.onreadystatechange=function()
	{
  	if(xmlHttp.readyState==4)
		{
		if (xmlHttp.status ==200)
			{	
				if(AjaxToggle == 'true')
				{
					dhtmlHistory.add('home', 'home');
				}
				document.all('dvProductCenter').innerHTML ='';
				document.all('dvLeftMenu').innerHTML ='';
				document.all('dvProductMain').style.display ='none';
				document.all('dvMain').style.display ='block';
				document.all('dvMain').innerHTML  = xmlHttp.responseText;
				document.title = 'Dynamism';
				if(p11>1)
					rotateImageDivs();
				hideWaitImage();
			}
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function showRange(mainCategoryID, mainCategoryName, attributeID,sortedAttributeName)
{
	var xmlHttp;
	var randomNum = Math.random(mainCategoryID, mainCategoryName, attributeID,sortedAttributeName);
	var url= urlAppender + '/categorysortedattributerange.do?CategoryID='+mainCategoryID+'&AttributeID='+attributeID+'&RNo='+randomNum+'&CategoryName='+mainCategoryName+'&AttribiteName='+sortedAttributeName+'&AjaxToggle='+AjaxToggle;//dirPath+
	showWaitImage();
	try
		{
		//Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
	catch (e)
		{		
		//Internate Explorer
		try
		  {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		catch (e)
			{
			try
		 	{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		 	}
			catch (e)
			{
			alert("Your browser does not support AJAX!");
			return false;
			}
	  	}
	}
	xmlHttp.onreadystatechange=function()
	{
  	if(xmlHttp.readyState==4)
		{
		if (xmlHttp.status ==200)
			{	
				document.all('dvLeftMenu').innerHTML = xmlHttp.responseText;
				hideWaitImage();
			}
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function getProductsByAttributeRange(maincategoryID,fromValue,toValue,attributeID)
{
	var xmlHttp;
	var randomNum = Math.random();
	var url= urlAppender + '/productsfromtovalue.do?CategoryID='+maincategoryID+'&AttributeID='+attributeID+'&RNo='+randomNum+'&FromValue='+fromValue+'&ToValue='+toValue+'&AjaxToggle='+AjaxToggle;//dirPath+
	showWaitImage();
	try
		{
		//Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
	catch (e)
		{		
		//Internate Explorer
		try
		  {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		catch (e)
			{
			try
		 	{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		 	}
			catch (e)
			{
			alert("Your browser does not support AJAX!");
			return false;
			}
	  	}
	}
	xmlHttp.onreadystatechange=function()
	{
  	if(xmlHttp.readyState==4)
		{
		if (xmlHttp.status ==200)
			{	
				document.all('dvProductCenter').innerHTML  = xmlHttp.responseText;
				hideWaitImage();
			}
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function getAccessoriesItems(productData, categoryID)
{
	var xmlHttp;
	if(productData != 'mainCategory')
	{
		productDataArr = productData.split('~');
		var productID = productDataArr[0];
		var productName = productDataArr[1];
		var randomNum = Math.random();
		var url='';
		if(BrowserDetect.browser=='Firefox' || BrowserDetect.browser=='Explorer'){
			url= urlAppender + '/getAccessoriesItem.do?ProductID='+productID+'&RNo='+randomNum+'&AjaxToggle='+AjaxToggle;//dirPath+
		}
		else
		{
			url= urlAppender + '/getAccessoriesItem.do?ProductID='+productID+'&ProductName='+productName+'&RNo='+randomNum+'&AjaxToggle='+AjaxToggle;//dirPath+
		}	
		showWaitImage();
		try
			{
			//Firefox, Opera 8.0+, Safari
			xmlHttp=new XMLHttpRequest();
			}
		catch (e)
			{		
			//Internate Explorer
			try
			  {
			  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			  }
			catch (e)
				{
				try
			 	{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			 	}
				catch (e)
				{
				alert("Your browser does not support AJAX!");
				return false;
				}
		  	}
		}
		xmlHttp.onreadystatechange=function()
		{
	  	if(xmlHttp.readyState==4)
			{
			if (xmlHttp.status ==200)
				{	
					document.all('dvCategoryPage').innerHTML  = xmlHttp.responseText;
					getCategorySortedAttribute(categoryID,0,0,'true');
					hideWaitImage();
				}
			}
		}
		xmlHttp.open("POST",url,true);
		//xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8");
		xmlHttp.setRequestHeader("ProductName", productName);
		xmlHttp.setRequestHeader("Content-type", "text/html; charset=UTF-8");
		
		xmlHttp.send(null);
	}	
}

function shopingCart()
{
   if(document.implementation.createDocument) {
		document.forms['shopingForm'].continues.value = window.location.href;
	}
	else
	{
		document.forms['shopingForm'].elements('continues').value = window.location.href;
	}
   document.forms['shopingForm'].submit();
}
//To get Main & Parent Category ID
function showErrorPage()
{
	var xmlHttp;
	var randomNumber=Math.random();
	var url= urlAppender + '/error.jsp';//dirPath+
	showWaitImage();
	try
		{
		//Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
	catch (e)
		{		
		//Internate Explorer
		try
		  {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		catch (e)
			{
			try
		 	{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		 	}
			catch (e)
			{
			alert("Your browser does not support AJAX!");
			return false;
			}
	  	}
	}
	xmlHttp.onreadystatechange=function()
	{
  	if(xmlHttp.readyState==4)
		{
		if (xmlHttp.status ==200)
			{	
				document.all('dvMain').style.display= 'block';
				document.all('dvMain').innerHTML = xmlHttp.responseText;
				document.all('dvProductMain').style.display = 'none';
				hideWaitImage();
			}
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function buttonmouseoverProductDetail(obj)
{
	obj.style.backgroundColor="#ECF4FF";
	obj.style.color="#000000";
}
function buttonmouseoutProductDetail(obj)
{
	obj.style.backgroundColor="#797979";
	obj.style.color="#FFFFFF";
}

function rotateImageDivs() {
	if(document.getElementById("SlideShow")!=null)
	{
		if(document.all) {
			document.images.SlideShow.style.filter="blendTrans(duration=2)";
			document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";
			document.images.SlideShow.filters.blendTrans.Apply();
			abc();
		}
		else
		{
			$(document.images.SlideShow).fadeTo("slow", 0.1);
			setTimeout('abc()', slideShowSpeed1);
		}
		if (document.all) {
			document.images.SlideShow.filters.blendTrans.Play();
		}
		else
		{
			$(document.images.SlideShow).fadeTo("slow", 1.0);
		}
	}
	else
	{
		setTimeout('rotateImageDivs()', slideShowSpeed);
	}
}
function abc()
{
	advLink.href = imageLink[j11];
	document.images.SlideShow.src = preLoad[j11].src;
	j11 = j11 + 1;
	if (j11 > (p11 - 1)) j11 = 0;
	t11 = setTimeout('rotateImageDivs()', slideShowSpeed);
}

function getHiddenFieldsForMenu() {
	var xmlHttp;
	var randomNumber=Math.random();
	var url= urlAppender + '/getHiddenFieldsForMenu.do?reqCode=getHiddenFieldsForMenu&RandomNumber='+randomNumber;
	showWaitImage();
	try {
		xmlHttp=new XMLHttpRequest();
	} catch (e) {		
		try {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		 	} catch (e) {
				alert("Your browser does not support AJAX!");
				return false;
			}
	  	}
	}
	xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState==4) {
			if (xmlHttp.status ==200) {	
				document.getElementById('divHiddenValues').innerHTML = xmlHttp.responseText;
				hideWaitImage();
			}
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function hidePopupDiv() {
	document.getElementById("divProductDetail").style.display = "none";
}

function showPopupDiv(categoryValue, productUrlCode_1, rightMenu) {
	var productSelected;
	if(rightMenu) {
		findPos(document.getElementById('lmenu_'+productUrlCode_1));
		document.getElementById("divProductDetail").style.top=(curtop+3)+'px';
		document.getElementById("divProductDetail").style.left=(curleft+130)+'px';
		productSelected = document.getElementById('lmenu_'+productUrlCode_1).innerHTML;
	} else {
		findPos(document.getElementById(productUrlCode_1));
		document.getElementById("divProductDetail").style.top=(curtop-6)+'px';
		document.getElementById("divProductDetail").style.left=(curleft+169)+'px';
		productSelected = document.getElementById(productUrlCode_1).innerHTML;
	}
	document.getElementById("divProductDetail").style.display="block";
	document.getElementById("divProductDetail").style.width=210+'px';
	document.getElementById("divProductDetail").style.height=80+'px';	
	var textToBeDisplayed = '';
	var productInformation = '';
	var valueOfCategory =  document.getElementById('hidden_'+categoryValue).value;
	var productsArray = valueOfCategory.split('|');
	for(i = 0; i < productsArray.length; i++) {
		var particularProduct = productsArray[i].split('~');
		if(particularProduct[0] == productUrlCode_1) {
			productInformation = particularProduct[1];
			break;
		}
	}
	var borderColor = '#BEBEBE';
	if(rightMenu) {
		borderColor = '#BEBEBE';
	}
	var textToBeDisplayed = '<table cellspacing=0 cellpadding=0 bgcolor=\"#FFFFFF"\ width=\"100%\" style=\"border: 2px; border-color:'+borderColor+';border-style: solid;\">'+
							'<tr><td style=\"padding:5px\"><table cellspacing=\"5px\" bgcolor=\"#FFFFFF\" width=\"100%\">'+
							'<tr width=\"210px\" height=\"80px\"> ';
	textToBeDisplayed = textToBeDisplayed + '<td bordercolor=blue width=\"70px\" height=\"70px\" bgcolor=\"#FFFFFF\">'+
											' <img width=\"70px\" src=\"'+imagepath+'product/'+productUrlCode_1+'_sm.jpg\"></td>';
	textToBeDisplayed = textToBeDisplayed + '<td bordercolor=red valign=\"top\" class=\"mouseove_10px\">'+productInformation+'</td>';
	textToBeDisplayed = textToBeDisplayed + '</tr> </table></td></tr></table>';
	document.getElementById("divProductDetail").innerHTML = textToBeDisplayed;
}
// End of addition by Ram Subramanian


//Function to get holiday Page
function getHolidayPage(parentCategoryID)
{
	var xmlHttp;
	var randomNumber=Math.random();
	var url= urlAppender + '/holiday.do?RandomNumber='+randomNumber+'&AjaxToggle='+AjaxToggle+'&ParentCategoryID='+parentCategoryID;//dirPath+
	showWaitImage();
	try
		{
		//Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
	catch (e)
		{		
		//Internate Explorer
		try
		  {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		catch (e)
			{
			try
		 	{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		 	}
			catch (e)
			{
			alert("Your browser does not support AJAX!");
			return false;
			}
	  	}
	}
	xmlHttp.onreadystatechange=function()
	{
  	if(xmlHttp.readyState==4)
		{
		if (xmlHttp.status ==200)
			{	
				if(AjaxToggle == 'true')
				{
					dhtmlHistory.add("HolidayCatID="+parentCategoryID, parentCategoryID);
				}
				document.all('dvProductCenter').innerHTML ='';
				document.all('dvLeftMenu').innerHTML ='';
				document.all('dvProductMain').style.display ='none';
				document.all('dvMain').style.display ='block';
				document.all('dvMain').innerHTML  = xmlHttp.responseText;
				document.title = 'Dynamism Holiday Page';
				
				if(flagHA == 'true')
				{
					setIndexHolidayAdvertisement(document.all("hdnAdvertisementHoliday").value);
					rotateImageDivsHolidayAdvertisement();
					flagHA = 'false';
				}
				else
				{
					if(imagesDivArrayHA.length > 0){
						document.getElementById("imageSpaceDivHoliday").innerHTML = imagesDivArrayHA[indexHolidayAdvertisement];
					 }	
				}
				hideWaitImage();	
			}
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
var flagHA = 'true';
var indexHolidayAdvertisement = -1;
var imagesDivArrayHA = [];
//Method to create array of images of advertisement for holiday page & to set its default index Index
function setIndexHolidayAdvertisement(AdvertisementHoliday) {
	var advertisementWidth = 801;
	var arrAdvertisementHoliday = AdvertisementHoliday.split('@@@');
	if(arrAdvertisementHoliday[0] == 'Image')
	{
		if(arrAdvertisementHoliday[1] != null && arrAdvertisementHoliday[1] != '')
		{
			var arrAdHolidayImg = arrAdvertisementHoliday[1].split('@@');
			for(var i=0; i<arrAdHolidayImg.length-1; i++)
			{
				var arrAdHolidayImgLink = arrAdHolidayImg[i].split('@');
				link = "href=\""+urlAppender+arrAdHolidayImgLink[1]+"\"";
				imagesDivArrayHA[i] = "<table cellspacing=\"0\" cellpadding=\"0\" style=\"border-bottom:0px; border-bottom-style:solid; border-bottom-color:#F0F0F0;\"><tr><td height=200px><a "+link+"><img id=\"rotate\" alt=\"dynamism\" title=\"dynamism\" src=\""+imagepath+arrAdHolidayImgLink[0]+"\" border=0 width=\""+advertisementWidth+"\"></a></td></tr></table>";
			}
		}
	}
	else
	{
		if(arrAdvertisementHoliday[1] != null && arrAdvertisementHoliday[1] != '')
		{
			var arrAdHolidayImg = arrAdvertisementHoliday[1].split('@@');
			var arrAdHolidayImgLink = arrAdHolidayImg[0].split('@');
			link = "href=\""+urlAppender+arrAdHolidayImgLink[1]+"\"";
			imagesDivArrayHA[0] = "<table cellspacing=\"0\" cellpadding=\"0\" style=\"border-bottom:0px; border-bottom-style:solid; border-bottom-color:#F0F0F0;\"><tr><td height=200px><a "+link+"><object width="+advertisementWidth+" ><param name=\"movie\" value=\""+imagepath + arrAdHolidayImgLink[0]+"\" ></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\""+imagepath + arrAdHolidayImgLink[0]+"\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\""+advertisementWidth+"\" ></embed></object></a></td></tr></table>";
		}
	}
	indexHolidayAdvertisement = Math.floor(Math.random() * imagesDivArrayHA.length);
}
//Method to rotate advertisement in holiday page
function rotateImageDivsHolidayAdvertisement() {
    indexHolidayAdvertisement++;
    if (indexHolidayAdvertisement >= imagesDivArrayHA.length)
        indexHolidayAdvertisement = 0;
       
	if(imagesDivArrayHA.length > 0){
		document.getElementById("imageSpaceDivHoliday").innerHTML = imagesDivArrayHA[indexHolidayAdvertisement];
	}
	if(imagesDivArrayHA.length > 1) {
		window.setTimeout(function(){rotateImageDivsHolidayAdvertisement();}, 7000);
	} 
}
//For Gift Item Page
function getGiftItemPage()
{
	var xmlHttp;
	var randomNumber=Math.random();
	
	var url= urlAppender + '/giftItemPage.do?reqCode=getActiveGiftItem&RandomNumber='+randomNumber;//dirPath+
	showWaitImage();
	try
		{
		//Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
	catch (e)
		{		
		//Internate Explorer
		try
		  {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		catch (e)
			{
			try
		 	{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		 	}
			catch (e)
			{
			alert("Your browser does not support AJAX!");
			return false;
			}
	  	}
	}
	xmlHttp.onreadystatechange=function()
	{
  	if(xmlHttp.readyState==4)
		{
		if (xmlHttp.status ==200)
			{	
				
				document.all('dvProductCenter').innerHTML = "";
				document.all('dvLeftMenu').innerHTML = "";
				document.all('dvProductMain').style.display = 'none';
				document.all('dvMain').style.display='block';
				document.all('dvMain').innerHTML = xmlHttp.responseText;
				if(AjaxToggle == 'true')
				{
					dhtmlHistory.add("GiftCard=true", 'GiftCard');
				}
				document.title = 'Dynamism';
				hideWaitImage();
			}
		}
	}
	xmlHttp.open("POST",url,true);//GET
	xmlHttp.send(null);
}

function getShoppingPopup(){
	findPos(document.getElementById("shoppingCartMenu"));
	var xmlHttp;
	
	var randomNumber = Math.random();
	var url= urlAppender + '/shoppingcartpopupdata.do?reqCode=getShopingPopupData&RandomNumber='+randomNumber;
	//showWaitImage();
	try
		{
		//Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
	catch (e)
		{		
		//Internate Explorer
		try
		  {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		catch (e)
			{
			try
		 	{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		 	}
			catch (e)
			{
			alert("Your browser does not support AJAX!");
			return false;
			}
	  	}
	}
	xmlHttp.onreadystatechange=function()
	{
  	if(xmlHttp.readyState==4)
		{
		if (xmlHttp.status ==200)
			{	
				document.getElementById("shoppingCartPopupDiv").innerHTML = xmlHttp.responseText;
				document.getElementById("shoppingCartPopupDiv").style.top = curtop+13;
				document.getElementById("shoppingCartPopupDiv").style.left = 567;//curleft+2;
				document.getElementById("shoppingCartPopupDiv").style.display = "block";
				shoppingPopupFlag = false;
				
			}
		}
	}
	if(shoppingPopupFlag == true)
	{
		xmlHttp.open("POST",url,true);
		xmlHttp.send(null);
	}
	else
	{
		document.getElementById("shoppingCartPopupDiv").style.top = curtop+13;
		document.getElementById("shoppingCartPopupDiv").style.left = 567;//curleft+2;
		document.getElementById("shoppingCartPopupDiv").style.display = "block";
	}
	//hideWaitImage();
	//shoppingPopupFlag = false;
}

function removeShoppingCart(){
	document.getElementById("shoppingCartPopupDiv").style.display = "none";
}
//To add Affilaite partner
function addAffiliatePartnerCode(strAffiliatePartnerCode)
{
	var xmlHttp;
	var randomNumber=Math.random();
	
	var url= urlAppender + '/addAffiliatePartnerCode.do?'+strAffiliatePartnerCode;//dirPath+
	showWaitImage();
	try
		{
		//Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
	catch (e)
		{		
		//Internate Explorer
		try
		  {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		catch (e)
			{
			try
		 	{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		 	}
			catch (e)
			{
			alert("Your browser does not support AJAX!");
			return false;
			}
	  	}
	}
	xmlHttp.onreadystatechange=function()
	{
  	if(xmlHttp.readyState==4)
		{
		if (xmlHttp.status ==200)
			{	
			}
		}
	}
	xmlHttp.open("POST",url,true);//GET
	xmlHttp.send(null);
}


function getDataOfAffiliatedSales(){
	var name = document.affiliatedsales.yourName.value;
	var email = document.affiliatedsales.yourEmail.value;
	var blog = document.affiliatedsales.yourBlog.value;
	var additionalMessage = document.affiliatedsales.yourAdditionalMessage.value;
	if(name==""){
		document.getElementById("name").style.display = "block";
		document.getElementById("email").style.display = "none";
		document.getElementById("email2").style.display = "none";
		document.getElementById("blog").style.display = "none";
		document.getElementById("additionalMessage").style.display = "none";
		return false;
	}
	if(email==""){
		document.getElementById("name").style.display = "none";
		document.getElementById("email").style.display = "block";
		document.getElementById("email2").style.display = "none";
		document.getElementById("blog").style.display = "none";
		document.getElementById("additionalMessage").style.display = "none";
		return false;
	}
	if(!validateEmail(email)){
		document.getElementById("name").style.display = "none";
		document.getElementById("email").style.display = "none";
		document.getElementById("email2").style.display = "block";
		document.getElementById("blog").style.display = "none";
		document.getElementById("additionalMessage").style.display = "none";
		return false;
	}
	if(blog==""){
		document.getElementById("name").style.display = "none";
		document.getElementById("email").style.display = "none";
		document.getElementById("email2").style.display = "none";
		document.getElementById("blog").style.display = "block";
		document.getElementById("additionalMessage").style.display = "none";
		return false;
	}
	
	var xmlHttp;
	var randomNumber=Math.random();
	var url= urlAppender + '/affiliateSalesSubmit.do?reqCode=affiliateSalesPageSubmit&randomNumber='+randomNumber+'&name='+name+'&email='+email+'&blog='+blog+'&additionalMessage='+additionalMessage;//dirPath+
	try
		{
		//Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
	catch (e)
		{		
		//Internate Explorer
		try
		  {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		catch (e)
			{
			try
		 	{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		 	}
			catch (e)
			{
			alert("Your browser does not support AJAX!");
			return false;
			}
	  	}
	}
	xmlHttp.onreadystatechange=function()
	{
  	if(xmlHttp.readyState==4)
		{
		if (xmlHttp.status ==200)
			{	
				document.getElementById("name").style.display = "none";
				document.getElementById("email").style.display = "none";
				document.getElementById("email2").style.display = "none";
				document.getElementById("blog").style.display = "none";
				document.getElementById("additionalMessage").style.display = "none";
				document.getElementById("informationCollectionBlock").style.display = "none";
				document.getElementById("confirmationDiv").style.display = "block";
			}
		}
	}
	xmlHttp.open("POST",url,true);//GET
	xmlHttp.send(null);
}

function getAffiliateSalesStatic(){
	var xmlHttp;
	var randomNumber=Math.random();
	var url= urlAppender + '/getAffiliateSalesPage.do?reqCode=getAffiliateSalesStaticPage&RNO='+randomNumber;//dirPath+
	showWaitImage();
	try
		{
		//Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
	catch (e)
		{		
		//Internate Explorer
		try
		  {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		catch (e)
			{
			try
		 	{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		 	}
			catch (e)
			{
			alert("Your browser does not support AJAX!");
			return false;
			}
	  	}
	}
	xmlHttp.onreadystatechange=function()
	{
  	if(xmlHttp.readyState==4)
		{
		if (xmlHttp.status ==200)
			{	
				document.all('dvProductCenter').innerHTML = "";
				document.all('dvLeftMenu').innerHTML = "";
				document.all('dvProductMain').style.display = 'none';
				document.all('dvMain').style.display='block';
				document.all('dvMain').innerHTML = xmlHttp.responseText;
				if(AjaxToggle == 'true')
				{
					dhtmlHistory.add("AffiliateSalesStatic=true", 'AffiliateSalesStatic');
				}
				document.title = 'Dynamism';
				hideWaitImage();
			}
		}
	}
	xmlHttp.open("POST",url,true);//GET
	xmlHttp.send(null);
}

function  validateKeyCodeNewsletterRightLinkByAffiliatedPage()
{	
	
	if(BrowserDetect.browser=='Firefox'){
	if(document.implementation.createDocument) {
		document.onkeyup = function alertkey(e)
							{
								if(e.which==13){
									subscribeCustomerByAffiliatedPage();
									return false;
							 	}		
							};
	 }	
	} else {
		if((event.charCode != null && event.charCode == 13)  || (event.keyCode != null && event.keyCode == 13 )){
			  subscribeCustomerByAffiliatedPage();
			return false;
		}	
	}

}


function subscribeCustomerByAffiliatedPage()
{  
	var xmlHttp;
	var email = document.all('txtEmailRightByAffiliatePage').value;
	var subscribedForDailyNewsLetter = "N";
	if(email==""){
		document.getElementById("errorMsg1").style.display = "block";
		document.getElementById("errorMsg2").style.display = "none";
		document.getElementById("errorMsg3").style.display = "none";
		return false;
	}	
	if(!validateEmail(email))
	{
		document.getElementById("errorMsg2").style.display = "block";
		document.getElementById("errorMsg3").style.display = "none";
		document.getElementById("errorMsg1").style.display = "none";	
		return false;
	}
	var randomNumber=Math.random();
	var url= urlAppender + '/subscriber.do?reqCode=addSubscriber&email='+email+'&subscribedForDailyNewsLetter='+subscribedForDailyNewsLetter+'&RandomNumber='+randomNumber;//dirPath+
	// showWaitImage();
	try
		{
		//Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
	catch (e)
		{		
		//Internate Explorer
		try
		  {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		catch (e)
			{
			try
		 	{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		 	}
			catch (e)
			{
			alert("Your browser does not support AJAX!");
			return false;
			}
	  	}
	}
	xmlHttp.onreadystatechange=function()
	{
  	if(xmlHttp.readyState==4)
		{
		if (xmlHttp.status ==200)
			{	
				document.getElementById("errorMsg2").style.display = "none";
				document.getElementById("errorMsg1").style.display = "none";
				document.getElementById("errorMsg3").style.display = "block";
				document.getElementById('errorMsg3').innerHTML = xmlHttp.responseText;	
			}
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function openGizmineProduct(categoryCode, productCode)
{
	window.open('http://www.gizmine.com/'+categoryCode+'/'+productCode+'.shtml','Gizmine')
}

function showGizmineProduct()
{
	var xmlHttp;
	var randomNumber=Math.random();
	var url= urlAppender + '/gizmineProductPage.do?RandomNumber='+randomNumber
	showWaitImage();
	try
		{
		//Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
	catch (e)
		{		
		//Internate Explorer
		try
		  {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		catch (e)
			{
			try
		 	{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		 	}
			catch (e)
			{
			alert("Your browser does not support AJAX!");
			return false;
			}
	  	}
	}
	xmlHttp.onreadystatechange=function()
	{
  	if(xmlHttp.readyState==4)
		{
		if (xmlHttp.status ==200)
			{	
				document.all('dvMain').style.display='none';
				document.all('dvProductMain').style.display ='block';
				document.all('dvProductCenter').style.display = 'block';
				document.all('dvLeftMenu').style.display = 'block';
				document.all('dvProductCenter').innerHTML = xmlHttp.responseText;
				document.all('dvLeftMenu').innerHTML = '';
				if(AjaxToggle == 'true')
				{
					dhtmlHistory.add("GizminePage=true", '');
				}
				document.title = 'Dynamism - Gizmine Top 20 products';
				hideWaitImage();
			}
		}
	}
	xmlHttp.open("POST",url,true);//GET
	xmlHttp.send(null);
}
function chnageVersionImg(obj, imgName)
{
	obj.src = imgName;
}
function changeUSVersionImg(imgName, flagCallType)
{
	document.all('uslinkimage').src = imgName;
	if(flagCallType==1)
		document.all('uslink').style.textDecoration = 'underline';
	else
		document.all('uslink').style.textDecoration = 'none';
}
function showPopupDivTopMenu(categoryValue, productUrlCode_1) {
	var productSelected;
	document.getElementById("divProductDetail_"+categoryValue).style.display="block";
	var textToBeDisplayed = '';
	var productInformation = '';
	var valueOfCategory =  document.getElementById('hidden_'+categoryValue).value;
	var productsArray = valueOfCategory.split('|');
	for(i = 0; i < productsArray.length; i++) {
		var particularProduct = productsArray[i].split('~');
		if(particularProduct[0] == productUrlCode_1) {
			productInformation = particularProduct[1];
			break;
		} 
	}
	var borderColor = '#BEBEBE';
	var textToBeDisplayed = "";
	if(productUrlCode_1 != ''){
		textToBeDisplayed = textToBeDisplayed + '<table cellspacing=0 cellpadding=0 border=\"0\" bgcolor=\"#FFFFFF"\ width=\"100%\" >';
		textToBeDisplayed =	textToBeDisplayed + '<tr><td valign=\"top\"><table cellspacing=\"5px\" bgcolor=\"#FFFFFF\" width=\"100%\">';
		textToBeDisplayed =	textToBeDisplayed + '<tr><td bordercolor=blue valign=\"top\"  height=\"70px\"   align=\"center\">'
											  +	'<table cellspacing=0 cellpadding=0><tr><td width=\"70px\">'
											  +'<img style=\" background-image: url('+imagepath+'loading_topmenu.gif);background-repeat: no-repeat;background-position: center;\"  align=\"center\" height=\"70px\" src=\"'+imagepath+'product/'+productUrlCode_1+'_sm.jpg\">'
											  +'</td></tr></table></td></tr>';
		textToBeDisplayed =	textToBeDisplayed + '<tr height=\"70px\"> ';
		textToBeDisplayed = textToBeDisplayed + '<td bordercolor=red valign=\"top\" class=\"mouseove_10px\" height=\"70px\">'+productInformation+'</td>';
		textToBeDisplayed = textToBeDisplayed + '</tr> </table></td></tr></table>';
	} else {
		textToBeDisplayed = textToBeDisplayed + '<table cellspacing=0 cellpadding=0 border=\"0\" bgcolor=\"#FFFFFF"\ height=\"140px\"  width=\"100%\" >';
		textToBeDisplayed = textToBeDisplayed + '<tr><td height=\"140px\"></td></tr>';
		textToBeDisplayed = textToBeDisplayed + '</table>';	
	}
	document.getElementById("divProductDetail_"+categoryValue).innerHTML = textToBeDisplayed;
	
}