 var xmlHttp;
//Author Name : Sagar Jadhav
//Author Site : http://www.webchutney.com
//Style Name  : Titan
//Site URL    : http://www.titanworld.com
//Version     : 2.0
//Comments    : Now models are going to be loaded dynamically...Thanks to AJAX.

 var baseURL = 'http://www.titanworld.com/collections/';
 var ajaxLoader = 'http://www.titanworld.com/ajax-loader.gif';
function showModel(Mid)
{
	var url = '';
	document.getElementById("model").innerHTML = '<div style="text-align:center; margin-top: 30%;"><img src="'+ ajaxLoader +'" style="border:none;"/></div>';
	xmlHttp=GetXmlHttpObject();
	url = baseURL+ "get_model/"+Mid;	 
	xmlHttp.onreadystatechange=displayModel 
	xmlHttp.open("POST",url,true);
	xmlHttp.send(null);
}

function displayModel() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 {		
			document.getElementById("model").innerHTML = '';
			document.getElementById("model").innerHTML = xmlHttp.responseText;
			showHide(1);
 	 } 
}

function showHide(SubId)
{
	if(SubId == 1)
	{
		document.getElementById('spec-div').style.display = "none";
		document.getElementById('spec').className = ""; 
		document.getElementById('desc-div').style.display = "block";
		document.getElementById('desc').className = 'selected';  
	}else 	if(SubId == 2)
	{
		document.getElementById('desc-div').style.display = "none";
		document.getElementById('desc').className = ""; 
		document.getElementById('spec-div').style.display = "block";
		document.getElementById('spec').className = 'selected';  
	}  
}
		//check whether browser supports AJAX or not!!!!
	function GetXmlHttpObject()
	{
	var xmlHttp=null;
	try
	 {
	 // Firefox, Opera 8.0+, Safari
	 xmlHttp=new XMLHttpRequest();
	 }
	catch (e)
	 {
	 // Internet Explorer
	 try
	  {
	  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	  }
	 catch (e)
	  {
	  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	 }
	return xmlHttp;
	}

 