// JavaScript Document
function UpdateURL(tabid){
	hashname='benefits';
	switch (tabid)
	{
		case 1:
			hashname='benefits';
			break;
		case 2:
			hashname='overview';
			break;
		case 3:
			hashname='highlights';
			break;
		case 4:
			hashname='versions';
			break;
		case 5:
			hashname='futurevers';
			break;
		case 6:
			hashname='history';
			break;	
		case 7:
			hashname='faq';
			break;
		case 8:
			hashname='slideshow';
			break;
		case 12:
			hashname='downloads';
			if(selvers!='')	hashname+="|vers="+selvers;
			break;
		case 9:
			hashname='prices';
			break;	
		case 10:
			hashname='oldvers';
			if(oldselvers!='')	hashname+="|vers="+oldselvers;
			break;
		case 11:
			hashname='forum';
			break;
		case 13:
			hashname='indsolution';
			break;

		default:
			
	}
	window.location.hash=hashname;	
	return hashname;
}
function parseurl()
{
	
URLFull=String(document.location);
prodpos=URLFull.indexOf('products/',0);
anchname='';
	if(prodpos>=0)
		{
			
			
			anchpos=URLFull.lastIndexOf("#");
			if(anchpos>0)
				anchname=URLFull.substr(anchpos+1);

		}
		if(anchname)
		{
			gettabid(anchname);
			sel(gettabid(anchname));
		}
		else
		{
			if(defaulttabid+""!='undefined')
				sel(defaulttabid);
		}
		
}

selvers='';
oldselvers='';

function gettabid(name)
{
	//alert(defaulttabid);
	if(strpos(name, 'vers=')!==false)
	{
		

		if(strpos(name, 'downloads')!==false)
		{
			selvers = name.substring(strpos(name, 'vers=')+5);
			name = 'downloads';			
		}
		else if(strpos(name, 'oldvers')!==false)
		{
			oldselvers = name.substring(strpos(name, 'vers=')+5);
			name = 'oldvers';
		}
		else
			name = 'benefits';
	}
	switch (name)
	{
		case 'benefits':
			tabid=1;
			break;
		case 'overview':
			tabid=2;
			break;
		case 'highlights':
			tabid=3;
			break;
		case 'versions':
			tabid=4;
			break;
		case 'futurevers':
			tabid=5;
			break;	
		case 'history':
			tabid=6;
			break;	
		case 'faq':
			tabid=7;
			break;
		case 'slideshow':
			tabid=8;
			break;
		case 'downloads':
			tabid=12;
			break;
		case 'prices':
			tabid=9;
			break;	
		case 'oldvers':
			tabid=10;
			break;
		case 'forum':
			tabid=11;
			break;
	case 'indsolution':
			tabid=13;
			break;

		default:
			tabid=defaulttabid;
			
	}
	if(tabid<defaulttabid)
		tabid=defaulttabid;
	return tabid;
}	
selectid=0;
selectid_m=0;
t='';
t2='';
function sel(id)
{
	
	if(id!=selectid)
			clearTimeout(t2);
	if(document.getElementById('tabname')+''!='null')		
		document.getElementById('tabname').value=UpdateURL(id);
	if(document.getElementById('more')+''!='null' )
		{
			if(document.getElementById('footer')+""!="null")
				document.getElementById('footer').style.display="none";
			if( document.getElementById('more').style.display=='none')
			{
				document.getElementById('more').style.display='';
				document.getElementById('morediv').style.display='none';
			}
			t=setTimeout('showfooter()',1);
		}
		UpdateURL(id);
	if(selectid_m>0)
		{
			if((selectid_m<8 || selectid_m >12 )&& selectid_m!=id)
				if(document.getElementById(selectid_m)+""!="null")
					document.getElementById(selectid_m).className="deseltab";
			
		}
		if(id<8 || id==13 )
		{//alert(id);
			if(document.getElementById(id)+""!="null")
				document.getElementById(id).className="seltab";
		}
		selectid_m=id;
		if(selectid>0){
			if(loadtabs(selectid,0)){
				document.getElementById('sec'+selectid).style.display="none";
			}
		}
	if(loadtabs(id,0)){
		if(t2)
			clearTimeout(t2);
		if(document.getElementById('loadtab')+""!="null")
			document.getElementById('loadtab').style.display='none';
		if(document.getElementById('footer')+""!="null")
			document.getElementById('footer').style.display="none";
	
		document.getElementById('sec'+id).style.display="block";
		//UpdateURL(id);
	
	t=setTimeout('showfooter()',1);
		}
	else
	{
		
		if(document.getElementById('loadtab')+""!="null")
			document.getElementById('loadtab').style.display='block';
		t2=setTimeout('sel('+id+')',1);
	}
	
	selectid=id;
	//selectid=id;
}


function showfooter()
{
	if(document.getElementById('footer')+""!="null")
	document.getElementById('footer').style.display="";
	clearTimeout(t);
}
function hov(id)
{

	if(selectid!=id)
	document.getElementById(id).className="seltab";

}
function deshov(id)
{

	if(selectid!=id)
	document.getElementById(id).className="deseltab";

}

function popup(id)
{
		
	var width=1010; 
	var height=550; 
	var left = parseInt((screen.availWidth/2) - (width/2));
    var top = parseInt((screen.availHeight/2) - (height/2));
return window.open("winpopup.php?pp=slideshow/slideshow&p2="+id,'',"scrollbars=no,menubar=no,height=550,width=1010,left=" + left + ",top=" + top + ",resizable=yes,toolbar=no,location=no,status=no");
	//if (window.focus) newwindow.focus();
}

function  loadtabs(tab1,tab2)
{
	/*if(document.getElementById('sec11')=='null')
	{
		t2=setTimeout('loadtabs()',1);
	}
	else
	{
		document.getElementById('loadtab').style.display='none';
		clearTimeout(t2);
	}*/
	if(document.getElementById('sec'+tab1))
	{
			if(tab2>0)
			{
				if(document.getElementById('sec'+tab2))
					{
						return true;
					}
			}
			else
				return true;
	}
	else
	 return false;
	
}
tf="";
function setTimeOutForFooter()
{
	if(tf)
	 clearTimeout(tf);
	if(document.getElementById('footer')+""!="null")
				document.getElementById('footer').style.display="";
}
function showmorehistory()
{
	
	if(document.getElementById('footer')+""!="null")
				document.getElementById('footer').style.display="none";
	if(document.getElementById('bottomtoolbar')+""!="null")
				document.getElementById('bottomtoolbar').style.display="none";
	document.getElementById('more').style.display='none';
	document.getElementById('morediv').style.display='';

	if(document.getElementById('bottomtoolbar')+""!="null")
				document.getElementById('bottomtoolbar').style.display="";	
			
	tf=setTimeout("setTimeOutForFooter()",5);
}
function strpos (haystack, needle, offset) 
{
    // Finds position of first occurrence of a string within another  
    // 
    // version: 1006.1915
    // discuss at: http://phpjs.org/functions/strpos    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Onno Marsman    
    // +   bugfixed by: Daniel Esteban
    // +   improved by: Brett Zamir (http://brett-zamir.me)
    // *     example 1: strpos('Kevin van Zonneveld', 'e', 5);    // *     returns 1: 14
    var i = (haystack+'').indexOf(needle, (offset || 0));
    return i === -1 ? false : i;

}

