// JavaScript Document
//Function to create Ajax Object-----------------------------------------------------------------------------------
function createajax()
{
   var objectname = false;	
	try { /*Internet Explorer Browsers*/ objectname = new ActiveXObject('Msxml2.XMLHTTP'); } 
	catch (e)
	{
		try { objectname = new ActiveXObject('Microsoft.XMLHTTP'); } 
		catch (e)  
		{
			try { /*// Opera 8.0+, Firefox, Safari*/ objectname = new XMLHttpRequest();	} 
			catch (e) { /*Something went wrong*/ alert('Your browser is not responding for Javascripts.'); return false; }
		}
	}
	return objectname;
}

function emptytext(elememtid)
{
	if(document.getElementById(elememtid).value=='Search')
	{
		document.getElementById(elememtid).value = '';
		document.getElementById(elememtid).style.color = '#000000';
	}
}

function searchdefault(elememtid)
{
	if(document.getElementById(elememtid).value=='')
	{
		document.getElementById(elememtid).value='Search';
		document.getElementById(elememtid).style.color = '#B1ACAB';
	}
}

function showdiv(divid)
{
	var a = document.getElementById(divid);
	if(a.style.display != "block")
	{
		a.style.display = "block";
	}
}
function showhidediv(divid)
{
	var a = document.getElementById(divid);
	if(a.style.display != "block")
	{
		a.style.display = "block";
	}
	else
	{
		a.style.display = "none";
	}
}

function hide(divid)
{
	var a = document.getElementById(divid);
	if(a.style.display == "block")
	{
		a.style.display = "none";
	}
}

function nextstep()
{
	var form = document.getElementById('downloadform');
	var productlist  = document.getElementById('product').value;
	var type = document.getElementById('type').value;
	if(productlist == '' || type == '')
		alert('Select the Product as well as Type');
	else if(productlist == 'premium' && type == 'broucher') { form.action = 'spp-pre-broucher.php'; form.submit(); }
	else if(productlist == 'premium' && type == 'featurelist') { form.action = 'spp-pre-featurelist.php'; form.submit(); }
	else if(productlist == 'premium' && type == 'patches') { form.action = 'spp-pre-patches.php'; form.submit(); }
	else if(productlist == 'premium' && type == 'releasenotes') { form.action = 'spp-pre-releasenotes.php'; form.submit(); }
	else if(productlist == 'premium' && type == 'software') { form.action = 'spp-pre-software.php'; form.submit(); }
	else if(productlist == 'premium' && type == 'tutorial') { form.action = 'spp-pre-tutorial.php'; form.submit(); }
	else if(productlist == 'standard' && type == 'broucher') { form.action = 'spp-std-broucher.php'; form.submit(); }
	else if(productlist == 'standard' && type == 'featurelist') { form.action = 'spp-std-featurelist.php'; form.submit(); }
	else if(productlist == 'standard' && type == 'patches') { form.action = 'spp-std-patches.php'; form.submit(); }
	else if(productlist == 'standard' && type == 'releasenotes') { form.action = 'spp-std-releasenotes.php'; form.submit(); }
	else if(productlist == 'standard' && type == 'software') { form.action = 'spp-std-software.php'; form.submit(); }
	else if(productlist == 'standard' && type == 'tutorial') { form.action = 'spp-std-tutorial.php'; form.submit(); }
	else if(productlist == 'professional' && type == 'broucher') { form.action = 'spp-prof-broucher.php'; form.submit(); }
	else if(productlist == 'professional' && type == 'featurelist') { form.action = 'spp-prof-featurelist.php'; form.submit(); }
	else if(productlist == 'professional' && type == 'patches') { form.action = 'spp-prof-patches.php'; form.submit(); }
	else if(productlist == 'professional' && type == 'releasenotes') { form.action = 'spp-prof-releasenotes.php'; form.submit(); }
	else if(productlist == 'professional' && type == 'software') { form.action = 'spp-prof-software.php'; form.submit(); }
	else if(productlist == 'professional' && type == 'tutorial') { form.action = 'spp-prof-tutorial.php'; form.submit(); }
	else if(productlist == 'compliant' && type == 'broucher') { form.action = 'spp-comp-broucher.php'; form.submit(); }
	else if(productlist == 'compliant' && type == 'featurelist') { form.action = 'spp-comp-featurelist.php'; form.submit(); }
	else if(productlist == 'compliant' && type == 'patches') { form.action = 'spp-comp-patches.php'; form.submit(); }
	else if(productlist == 'compliant' && type == 'releasenotes') { form.action = 'spp-comp-releasenotes.php'; form.submit(); }
	else if(productlist == 'compliant' && type == 'software') { form.action = 'spp-comp-software.php'; form.submit(); }
	else if(productlist == 'compliant' && type == 'tutorial') { form.action = 'spp-comp-tutorial.php'; form.submit(); }
}

function tabopen2(activetab,tabgroupname)
{
	//alert('1');
	var totaltabs = 2;
	var activetabheadclass = "tabheadsmallactive";
	var tabheadclass = "tabheadsmall";
	
	for(var i=1; i<=totaltabs; i++)
	{
		var tabhead = tabgroupname + 'h' + i;
		var tabcontent = tabgroupname + 'c' + i;
		if(i == activetab)
		{
			document.getElementById(tabhead).className = activetabheadclass;
			document.getElementById(tabcontent).style.display = 'block';
		}
		else
		{
			document.getElementById(tabhead).className = tabheadclass;
			document.getElementById(tabcontent).style.display = 'none';
		}
	}
}

function activediv(activedivid, inactivedivid)
{
	//alert('test');
	var activedivelement = document.getElementById(activedivid);
	var inactivedivelement = document.getElementById(inactivedivid);
	activedivelement.style.display = 'none';
	inactivedivelement.style.display = 'block';
}

/*function hide_elements(elementids, name)
{
	var elems=document.getElementByTagName('faqdiv');
	elems=elementids.split(',');
	var len = elems.length;
	for(i=0;i<len;i++)
	{
		element = document.getElementById(elems[i]);
		element.style.display = 'none';
	}
}*/

initDiv = function() 
{
	var navRoot = document.getElementById("primary-navigation");
	var lis = navRoot.getElementsByTagName("div");
	for (var i=0; i<lis.length; i++)
	{
		lis[i].onmouseclick = function()
		{
			document.getElementById('divactive').style.display = 'block';
		}
	}
}

if (window.addEventListener)
{
	window.addEventListener("load", initDiv, false);
}
else if (window.attachEvent)
{
	window.attachEvent("onload", initDiv);
}

function tabopen41(activetab,tabgroupname)
{
	var totaltabs = 69;
	var activetabheadclass = "tabheadsmallactive41";
	var tabheadclass = "tabheadsmall41";
	
	for(var i=1; i<=totaltabs; i++)
	{
		var tabhead = tabgroupname + 'h' + i;
		var tabcontent = tabgroupname + 'c' + i;
		if(i == activetab)
		{
			document.getElementById(tabhead).className = activetabheadclass;
			document.getElementById(tabcontent).style.display = 'block';
		}
		else
		{
			document.getElementById(tabhead).className = tabheadclass;
			document.getElementById(tabcontent).style.display = 'none';
		}
	}
}
function tabopen29(activetab,tabgroupname)
{
	var totaltabs = 29;
	var activetabheadclass = "tabheadsmallactive41";
	var tabheadclass = "tabheadsmall41";
	
	for(var i=1; i<=totaltabs; i++)
	{
		var tabhead = tabgroupname + 'h' + i;
		var tabcontent = tabgroupname + 'c' + i;
		if(i == activetab)
		{
			document.getElementById(tabhead).className = activetabheadclass;
			document.getElementById(tabcontent).style.display = 'block';
		}
		else
		{
			document.getElementById(tabhead).className = tabheadclass;
			document.getElementById(tabcontent).style.display = 'none';
		}
	}
}

function tabopen2level(activetab,tabgroupname)
{
	var totaltabs = 2;
	var activetabheadclass = "tabheadsmallactive";
	var tabheadclass = "tabheadsmall";
	
	for(var i=1; i<=totaltabs; i++)
	{
		var tabhead = tabgroupname + 'hc' + i;
		var tabcontent = tabgroupname + 'cc' + i;
		if(i == activetab)
		{
			document.getElementById(tabhead).className = activetabheadclass;
			document.getElementById(tabcontent).style.display = 'block';
		}
		else
		{
			document.getElementById(tabhead).className = tabheadclass;
			document.getElementById(tabcontent).style.display = 'none';
		}
	}
}

function tabopen32(activetab,tabgroupname)
{
	var totaltabs = 32;
	var activetabheadclass = "tabheadsmallactive41";
	var tabheadclass = "tabheadsmall41";
	
	for(var i=1; i<=totaltabs; i++)
	{
		var tabhead = tabgroupname + 'h' + i;
		var tabcontent = tabgroupname + 'c' + i;
		if(i == activetab)
		{
			document.getElementById(tabhead).className = activetabheadclass;
			document.getElementById(tabcontent).style.display = 'block';
		}
		else
		{
			document.getElementById(tabhead).className = tabheadclass;
			document.getElementById(tabcontent).style.display = 'none';
		}
	}
}

function tabopen8(activetab,tabgroupname)
{
	var totaltabs = 8;
	var activetabheadclass = "tabheadsmallactive41";
	var tabheadclass = "tabheadsmall41";
	
	for(var i=1; i<=totaltabs; i++)
	{
		var tabhead = tabgroupname + 'h' + i;
		var tabcontent = tabgroupname + 'c' + i;
		if(i == activetab)
		{
			document.getElementById(tabhead).className = activetabheadclass;
			document.getElementById(tabcontent).style.display = 'block';
		}
		else
		{
			document.getElementById(tabhead).className = tabheadclass;
			document.getElementById(tabcontent).style.display = 'none';
		}
	}
}

function tabopen5(activetab,tabgroupname)
{
	var totaltabs = 5;
	var activetabheadclass = "tabheadsmallactive41";
	var tabheadclass = "tabheadsmall41";
	
	for(var i=1; i<=totaltabs; i++)
	{
		var tabhead = tabgroupname + 'h' + i;
		var tabcontent = tabgroupname + 'c' + i;
		if(i == activetab)
		{
			document.getElementById(tabhead).className = activetabheadclass;
			document.getElementById(tabcontent).style.display = 'block';
		}
		else
		{
			document.getElementById(tabhead).className = tabheadclass;
			document.getElementById(tabcontent).style.display = 'none';
		}
	}
}

function tabopen23(activetab,tabgroupname)
{
	var totaltabs = 23;
	var activetabheadclass = "tabheadsmallactive41";
	var tabheadclass = "tabheadsmall41";
	
	for(var i=1; i<=totaltabs; i++)
	{
		var tabhead = tabgroupname + 'h' + i;
		var tabcontent = tabgroupname + 'c' + i;
		if(i == activetab)
		{
			document.getElementById(tabhead).className = activetabheadclass;
			document.getElementById(tabcontent).style.display = 'block';
		}
		else
		{
			document.getElementById(tabhead).className = tabheadclass;
			document.getElementById(tabcontent).style.display = 'none';
		}
	}
}

//Function to display the error message in box---------------------------------------------------------------------
function errormessage(message)
{
	var msg = '<div class="errorbox">' + message + '</div>';
	return msg;
}

//Function to display the success message in box-------------------------------------------------------------------
function successmessage(message)
{
	var msg = '<div class="successbox">' + message + '</div>';
	return msg;
}

//Function to check the vaslid format of email ID [Common Function]
function checkemail(a)
{
  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
  return (!r1.test(a) && r2.test(a));
}

/*-------------Open the popup window for Registration-----------------*/
function MM_openBrWindow(theURL,winName,features) 
{
  window.open(theURL,winName,features);
}

function userfullinkstab(activetab,tabgroupname)
{
	var totaltabs = 4;
	var activetabheadclass = "tabheadsmallactive";
	var tabheadclass = "tabheadsmall";
	
	for(var i=1; i<=totaltabs; i++)
	{
		var tabhead = tabgroupname + 'hc' + i;
		var tabcontent = tabgroupname + 'cc' + i;
		if(i == activetab)
		{
			document.getElementById(tabhead).className = activetabheadclass;
			document.getElementById(tabcontent).style.display = 'block';
		}
		else
		{
			document.getElementById(tabhead).className = tabheadclass;
			document.getElementById(tabcontent).style.display = 'none';
		}
	}
}



function tabopen8(activetab,tabgroupname)
{
	var totaltabs = 8;
	//var activetabheadclass = "vertabheadactive";
//	var tabheadclass = "vertabhead";
	
	for(var i=1; i<=totaltabs; i++)
	{
		var tabhead = tabgroupname + 'h' + i;
		var tabcontent = tabgroupname + 'c' + i;
		if(i == activetab)
		{
		//	document.getElementById(tabhead).className = activetabheadclass;
			if(document.getElementById(tabcontent).style.display == 'block')
				document.getElementById(tabcontent).style.display = 'none';
			else
				document.getElementById(tabcontent).style.display = 'block';

		}
		else
		{
			//document.getElementById(tabhead).className = tabheadclass;
			document.getElementById(tabcontent).style.display = 'none';
			
		}
	}
}


function tabopen2(activetab,tabgroupname)
{
		//alert('2');
	var totaltabs = 2;
	var activetabheadclass = "tabactiveclassversion";
	var tabheadclass = "tabinactiveclassversion";
	
	for(var i=1; i<=totaltabs; i++)
	{
		var tabhead = tabgroupname + 'h' + i;
		var tabcontent = tabgroupname + 'c' + i;
		if(i == activetab)
		{

				document.getElementById(tabcontent).style.display = 'block';
				document.getElementById(tabhead).className = activetabheadclass;
		}
		else
		{
			//
			document.getElementById(tabcontent).style.display = 'none';
			document.getElementById(tabhead).className = tabheadclass;
			
		}
	}
}

function tabopen1(activetab,tabgroupname)
{
	var totaltabs = 1;
	//var activetabheadclass = "vertabheadactive";
//	var tabheadclass = "vertabhead";
	
	for(var i=1; i<=totaltabs; i++)
	{
		var tabhead = tabgroupname + 'hd' + i;
		var tabcontent = tabgroupname + 'ct' + i;
		if(i == activetab)
		{
		//	document.getElementById(tabhead).className = activetabheadclass;
			if(document.getElementById(tabcontent).style.display == 'block')
				document.getElementById(tabcontent).style.display = 'none';
			else
				document.getElementById(tabcontent).style.display = 'block';

		}
		else
		{
			//document.getElementById(tabhead).className = tabheadclass;
			document.getElementById(tabcontent).style.display = 'none';
			
		}
	}
}