var djConfig = {
	isDebug: false,
	debugAtAllCosts: false
};


/**** Clicked on compatible devices ****/
function clickedCompatibleDevices()
{
	var compatibleNode = dojo.byId("compatible_layer");
	var wholePageNode = dojo.byId('whole_page');
	if(!compatibleNode.style.display || compatibleNode.style.display == 'none')
	{
		compatibleNode.style.display='block';
		dojo.fx.html.fade(wholePageNode, 500, 0.9, 0.3);
		dojo.fx.html.slideBy(compatibleNode, [0,200], 500);
	
		// Pass info to webtrends
		dcsMultiTrack_strict('DCS.dcsuri','/PlatformProductDetail.jsp','DCS.dcsqry','?detailTab=compatible','WT.ti','Product Detail Page - compatible','WT.cg_n','Product Detail','WT.cg_s','compatible');
	}
}

function closeCompatibleWindow()
{
	var compatibleNode = dojo.byId("compatible_layer");
	var wholePageNode = dojo.byId('whole_page');
	if(compatibleNode.style.display == 'block')
	{
		compatibleNode.style.display='none';
		compatibleNode.style.left = '30%';
		compatibleNode.style.top = '0';
		dojo.fx.html.fade(wholePageNode, 500, 0.3, 1.0);
	}
}

/**** End Clicked on compatible devices ****/



/**** Clicked on "View More Screenshots" ****/
function clickedViewMoreScreenshots(productId)
{
	javascript:opennewwindow('/resources/catalog/product/Platform_ProductDetail_Screenshots.jsp?productId='+productId,'screenshots','700','400');
	// Pass info to webtrends
	dcsMultiTrack_strict('DCS.dcsuri','/PlatformProductDetail.jsp','DCS.dcsqry','?detailTab=screenshots','WT.ti','Product Detail Page - screenshots','WT.cg_n','Product Detail','WT.cg_s','screenshots');
}
function clickedViewMoreScreenshotsEFIGS(productId)
{
	 window.open("/include/international/MoreScreenShots.jsp?productId="+productId, "screenshots",  "width=700,height=400");
	//javascript:opennewwindow('/include/international/MoreScreenShots.jsp?productId='+productId,'screenshots','400','200');
	
}
/**** End Clicked on "View More Screenshots" ****/

/**** Clicked on "View Compatible Devices" ****/

function clickedViewCompatibleDevices(productId)
{
	javascript:opennewwindow('/compatibleDevices.jsp?productId='+productId,'700','400');
}

/**** End Clicked on "View Compatible Devices" ****/

/**** Start compatible devices scripts ****/
var http_comp_devices = createRequestObject_comp_devices();

function createRequestObject_comp_devices()
{
    var ro;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer"){
        ro = new ActiveXObject("Microsoft.XMLHTTP");
    }else{
        ro = new XMLHttpRequest();
    }
    return ro;
}

var productName = "";
function updateCompatibleDevices(productId, pName)
{
	productName = pName;
	var partnerId = document.compatibleDeviceForm.compatibleDeviceSelect.value;
	var servletPath = '/servlet/CompatibleDevices_ProductPageAJAX?productId='+productId+'&partnerId='+partnerId+'&isAjaxRequest=true';
	http_comp_devices.open('post', servletPath);
	http_comp_devices.onreadystatechange = handleResponse_comp_devices;
	http_comp_devices.setRequestHeader('Content-Type', 'text/xml');
	http_comp_devices.send(servletPath);
}

function handleResponse_comp_devices()
{
	try
	{
		if(http_comp_devices.readyState == 4)
		{
			if (http_comp_devices.status == 200)
			{
				var responseText = http_comp_devices.responseText;
				var deviceId = "";
				var deviceName = "";
				var isCompatible = "";
				var compatible_list_left = "<ul>";
				var compatible_list_right = "<ul>";
				var i = 0;
				
				var itemNumber = 0;
				for(var i = 0; responseText != '' && deviceId != "end" && deviceName != "end"; i++)
				{
					var item = http_comp_devices.responseXML.getElementsByTagName("id")[i];
					var item2 = http_comp_devices.responseXML.getElementsByTagName("name")[i];
					
					if(item)
						deviceId = item.firstChild.nodeValue;
	
					if(item2)
						deviceName = item2.firstChild.nodeValue;
					
					if (deviceId == "end" || deviceName == "end")
					{
						continue;
					}

					var item3 = http_comp_devices.responseXML.getElementsByTagName("isCompatible")[i];
					if(item3)
						isCompatible = item3.firstChild.nodeValue;

					if(isCompatible == 'true')
					{
						if(itemNumber % 2 == 0)
						{
							compatible_list_left = compatible_list_left + "<li>"+deviceName+"</li>";
						}
						else if(itemNumber % 2 == 1)
						{
							compatible_list_right = compatible_list_right + "<li>"+deviceName+"</li>";;
						}
						itemNumber++;
					}
				}

				var index = document.compatibleDeviceForm.compatibleDeviceSelect.selectedIndex;
				var manufacturerName = document.compatibleDeviceForm.compatibleDeviceSelect.options[index].text;
				if(responseText == '')
				{
					dojo.byId("compatible_devices").innerHTML = '';
					dojo.byId("compatible_list_left").innerHTML = '';
					dojo.byId("compatible_list_right").innerHTML = '';
				}
				else if(compatible_list_left.length < 5)
				{
					dojo.byId("compatible_devices").innerHTML = '<br><table width="100%" border="0" cellspacing="0" cellpadding="4"><tr><td><strong>There are no '+manufacturerName+' devices compatible with "'+productName+'"</strong></td></tr></table>';
					dojo.byId("compatible_list_left").innerHTML = '';
					dojo.byId("compatible_list_right").innerHTML = '';
				}
				else
				{
					dojo.byId("compatible_devices").innerHTML = '<br><p><strong>Compatible Devices</strong></p>';
					dojo.byId("compatible_list_left").innerHTML = compatible_list_left;
					dojo.byId("compatible_list_right").innerHTML = compatible_list_right;
				}
			}
		}
	}
	catch(err)
	{
		alert(err);
	}
}

function getUrlParameter(strParamName)
{
	var strReturn = "";
	var strHref = window.location.href;
	if ( strHref.indexOf("?") > -1 )
	{
		var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
		var aQueryString = strQueryString.split("&");
		for ( var iParam = 0; iParam < aQueryString.length; iParam++ )
		{
			if (aQueryString[iParam].indexOf(strParamName + "=") > -1 )
			{
				var aParam = aQueryString[iParam].split("=");
				strReturn = aParam[1];
				break;
			}
		}
	}
return strReturn;
} 
/**** End compatible devices scripts ****/

