// JavaScript Document

function LoadPage(page,usediv,w) {
	
		
         try {xmlhttp = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");}  catch (e) { alert("Error: Could not load page.");}
		 
		 ajax_icon = '<div class="ajax-loader"><img src="img/ajax-loader-'+w+'.gif" border="0" alt="Loading..." /></div>';
		 
         document.getElementById(usediv).innerHTML = ajax_icon;
		 

         xmlhttp.onreadystatechange = function(){

                 if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {

                        document.getElementById(usediv).innerHTML = xmlhttp.responseText;
						//tb_init('a.thickboximg');
                 }
         }
	
		 
         xmlhttp.open("GET", page);
		 	 
         xmlhttp.send(null);		 
 
		 document.getElementById(usediv).style.display = 'block';	
 
         return false;
}

function Slider(type,id)
{
	var panels = sp.getContentPanels();	
	var cur_index = sp.getContentPanelIndex(sp.currentPanel);
	var max_index = sp.getContentPanelsCount();	
	var prev_index = cur_index;
	
	if (type == 'next')
	{
		if (cur_index < max_index - 1)
			cur_index = cur_index + 1;	
	}
	else if (type == 'prev')
	{
		if (cur_index > 0)
			cur_index = cur_index - 1;	
	}
	else
	{
		cur_index = id;
	}
									
		 for (var k=0; k<max_index; k++)
		 {
		 	if (k != cur_index)
			{
				document.getElementById('sm-'+k).className = '';
			}			
			else
			{
				document.getElementById('sm-'+k).className = 'sel-'+cur_index+' sm-curent';
				
			}
			
		 }	

	
		 
		 for (var k=0; k<max_index; k++)
		 {
				document.getElementById(panels[k].id).style.height = '400px';
		 }	
		 document.getElementById(panels[cur_index].id).style.height = 'auto';
		 
		 sp.showPanel(cur_index); 

	return false;
	
}


	
function SubSlider(parent,id,alls)
{
		document.getElementById('subtabs-'+parent+'-curent').className = 'subtabs-curent-'+id;
	
		 for (var k=0; k<alls; k++)
		 {
		 	if (k != id)
			{
				document.getElementById('ssm-'+parent+'-'+k).className = '';
				document.getElementById('subslide-'+parent+'-'+k).style.display = 'none';				
			}			
			else
			{
				document.getElementById('ssm-'+parent+'-'+k).className = 'ssm-curent';
				document.getElementById('subslide-'+parent+'-'+k).style.display = 'block';				
			}
			
		 }	
		 
	return false;
}

function LoadReCl(pg_5,pg_6,w) {
		
		 page_5 = 'subpanels/5.php'+'?pg='+pg_5;
		 page_6 = 'subpanels/6.php'+'?pg='+pg_6;
		 div_5 = 'subslide-5';
		 div_6 = 'subslide-6';		 
	
         try {xmlhttp = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");}  catch (e) { alert("Error: Could not load page.");}
		 
		 ajax_icon = '<div class="ajax-loader"><img src="img/ajax-loader-'+w+'.gif" border="0" alt="Loading..." /></div>';
		 
         document.getElementById(div_5).innerHTML = ajax_icon;
		 

         xmlhttp.onreadystatechange = function(){

                 if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {

                        document.getElementById(div_5).innerHTML = xmlhttp.responseText;
						tb_init('a.thickboximgre');			
                 }
         }
		 document.getElementById(div_5).style.display = 'block';		
		 			 
         xmlhttp.open("GET", page_5);
		 	 
         xmlhttp.send(null);		 		 
		 
		 
         try {xmlhttp2 = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");}  catch (e) { alert("Error: Could not load page.");}
		 
		 ajax_icon = '<div class="ajax-loader"><img src="img/ajax-loader-'+w+'.gif" border="0" alt="Loading..." /></div>';
		 
         document.getElementById(div_6).innerHTML = ajax_icon;
		 

         xmlhttp2.onreadystatechange = function(){

                 if ((xmlhttp2.readyState == 4) && (xmlhttp2.status == 200)) {

                        document.getElementById(div_6).innerHTML = xmlhttp2.responseText;
						tb_init('a.thickboximgcl');
				}
         }
		 
		 document.getElementById(div_6).style.display = 'block';			 						 																				
		 
         xmlhttp2.open("GET", page_6);		 		 
		 	 
         xmlhttp2.send(null);
		 
		 
		 return false;

}
