function xmlhttpPost(strURL, idx, p) 
{
	//var obj_zoom = document.getElementById('zoom');
	//obj_zoom.className='tdhidden';

	var xmlHttpReq = false;
    var self = this;
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            updatepage(self.xmlHttpReq.responseText, idx,p);
        }
    }
    self.xmlHttpReq.send(getquerystring(idx, p));
}
function getquerystring(idx, p)
{
	
	if(idx=="play")
	{
		
		qstr = 'x1=' + escape(p);
	}

	return qstr;
}
function updatepage(str, idx,p)
{
	if(idx == "play")
	{
		var ids = document.getElementById('song_ids').value
		var ids_arr = ids.split("***");
		for(i=0;i<ids_arr.length;i++)
		{
			if(document.getElementById('song'+i))
			{
				ocument.getElementById('song'+i).innerHTML = '';
			}
		}
		
		document.getElementById("song"+p).innerHTML=str;
	}
	

}

var is_opera = /opera\/9/i.test(navigator.userAgent);
var is_gecko = /gecko/i.test(navigator.userAgent);
var is_ie    = /MSIE/.test(navigator.userAgent);

function setCVisibleProd3(prod)
{
	document.getElementById(prod).style.visibility='visible';
	
}
 
function setCHiddenProd(prod)
{
	javascript:document.getElementById(prod).style.visibility='hidden';
}


function Clickheretoprint()
{
		var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,resizable=yes,"; 
		    disp_setting+="scrollbars=yes,width=750, height=600, left=100, top=25"; 
		var content_vlue = document.getElementById("print_content").innerHTML; 
		var fact_bot = document.getElementById("fact_bot").value; 
		
		var docprint=window.open("","",disp_setting);
			docprint.document.open(); 
			docprint.document.write('<html><head><title></title><style> input { display:none; } body,td{font-size:10px} </style>');
			docprint.document.write('</head><body onLoad="self.print()">');
			docprint.document.write('<div><img src="/images/logo_adm.gif" alt="" width="160"></div><center>');
			docprint.document.write(content_vlue);
			docprint.document.write('<br><br><br><div>');
			docprint.document.write(fact_bot);
			docprint.document.write('</div></center></body></html>'); 
			//docprint.document.getElementById("datadiv").style.display='block'; 
			//docprint.document.getElementById("statustd").style.display='none'; 
			docprint.document.close(); 
			docprint.focus(); 
}
/*
function checkVotingForm()
{
	var checked = 0;
	var val = document.voting_form.voting;
	for (i=0; i<val.length; i++)
	{
		if(val[i].checked) 
			checked = 1;
	}
	
	if(document.getElementById('vote_text').value.length > 10 && checked)
		return true;
	else
	{
		document.getElementById('popup8').style.visibility = 'visible';
		return false;
	}
}

function basketDelivery()
{
	var price = parseInt(document.getElementById("countries_sel").value);
	var total = parseInt(document.getElementById("total_id").value);
	document.getElementById("delprice_td").innerHTML = price;
	document.getElementById("totalprice_td").innerHTML = total+price;
}

function checkAll(formName)
{
	for(i=0;i<document.forms[formName].elements.length;i++)
	{
		if(document.forms[formName].chkall.checked)
			document.forms[formName].elements[i].checked=true;
		else
			document.forms[formName].elements[i].checked=false;
	}
}	

function compare_prod(alert_text, lang_code)
{
	var formName = 'prod_list';
	var id_str = '';
	var count = 0;
	document.getElementById('id_s').value = '';
	
	for(i=0;i<document.forms[formName].elements.length;i++)
	{
		if(document.forms[formName].elements[i].checked && document.forms[formName].elements[i].value > 0)
		{
			count++;
			id_str += document.forms[formName].elements[i].value+';';
		}
	}
	
	if(count > 1)
	{
		document.getElementById('id_s').value = id_str;
		window.open('/compare.php?id_s='+id_str+lang_code, 'compare', 'width=800,height=600,scrollbars=yes,location=no,resizable=yes');
	}
	else alert(alert_text);

	return false;
}
function view_attr(id)
{
	var ids = document.getElementById('ids').value;
	ids = ids.substr(3);
	var ids_arr = ids.split('***');
	
	for(var i=0; i<ids_arr.length; i++)
		document.getElementById('popup'+ids_arr[i]).style.display='none';
	
	document.getElementById('popup'+id).style.display='block';

	return false;
}





function loadUrlToBlock( urlToLoad, divId, param1, param2, param3, param3 )
{
	$(divId).innerHTML = "<img style='position:absolute;margin-left:150px' align='center' src='/images/progress.gif'  alt='' title='' />" + $(divId).innerHTML;
	//URL = 'http://www.google.com/search?q=Prototype';
	new Ajax.Request(  urlToLoad  , 
	{

  	method: 'post',
  	postBody: 'param1='+param1+'&param2='+param2,

	  	onSuccess: function(transport) 
	  	{
	  		//try 
	  		{
	  		$(divId).innerHTML = transport.responseText; // . evalScripts(); 
	  		}
	  		//catch(e)
	  		{
	  		//	alert(e.message);
	  		}
	  	}
	});
}

function disableCombo( chooseCategoryText, comboId )
{
	$(comboId).innerHTML= '';
  	var option = new Option( chooseCategoryText, 0,  0 );
	$(comboId).options[0] = option;
	$(comboId).disabled = 1;
}

function enableCombo( comboId )
{
	$(comboId).disabled = 0;
}

function brandComboChanged( chooseCategoryText, selectedId )
{
	if( $('brandCombo').value > 0 )
	{ 
		loadComboByQuery( chooseCategoryText, 'SELECT brand_id AS id, brand_name AS name FROM brand WHERE brand_pid = ' + $('brandCombo').value , 'subBrand', selectedId, 'SELECT brand_id AS id, brand_name AS name FROM brand WHERE 1 ');  
		enableCombo('subBrand'); 
	}
	else  
	{
		disableCombo( chooseCategoryText, 'subBrand');
	}
	disableCombo( chooseCategoryText, 'subSubBrand');
	setCookie('brandCombo', $('brandCombo').value, 100); 
}

function subBrandChanged( chooseCategoryText, selectedId )
{
	if( $('subBrand').value > 0 )
	{
		loadComboByQuery( chooseCategoryText, 'SELECT brand_id AS id, brand_name AS name FROM brand WHERE brand_pid = ' + $('subBrand').value , 'subSubBrand', selectedId, 'SELECT brand_id AS id, brand_name AS name FROM brand WHERE 1 ');   
		enableCombo('subSubBrand');
	}
	else
	{
		disableCombo( chooseCategoryText, 'subSubBrand');
	}
	
	setCookie('subBrand', $('subBrand').value, 100);
}

function subSubBrandChanged( selectedId )
{
	setCookie('subSubBrand', $('subSubBrand').value, 100);
	
	if( $('subSubBrand').value > 0 )
	{
		$('getCatsLink').disabled = false;
	}
	else
	{
		$('getCatsLink').disabled = true;
	}
}

function addToFavorites(id, msg)
{
	
	var favCookie = getCookie( 'fav' );
	if( favCookie == null )
		favCookie = ';';
	
	favCookie += id + ';';

	setCookie('fav', favCookie, 100 ) ;
	
	alert(msg);
}

function removeFav(id, msg)
{
	var favCookie = getCookie( 'fav' );
	if( favCookie == null )
		favCookie = ';';
	
	favCookie = favCookie.replace( ';' + id + ';',  ';');

	setCookie('fav', favCookie, 100 ) ;
	
	//document.location.href = document.location.href; //alert(msg);
	//window.location.href=window.location.href;
	window.location.reload();
}



function siteMap(bShow)
{
	document.getElementById('siteMap').style.display = ( bShow ) ?  'block' : 'none';
}

function showIt(bShow, elemId)
{
	document.getElementById( elemId ).style.display = ( bShow ) ?  'block' : 'none';
}
*/
/*
function URLEncode (clearString) {
  var output = '';
  var x = 0;
  clearString = clearString.toString();
  var regex = /(^[a-zA-Z0-9_.]*)/;
  while (x < clearString.length) {
    var match = regex.exec(clearString.substr(x));
    if (match != null && match.length > 1 && match[1] != '') {
    	output += match[1];
      x += match[1].length;
    } else {
      if (clearString[x] == ' ')
        output += '+';
      else {
        var charCode = clearString.charCodeAt(x);
        var hexVal = charCode.toString(16);
        output += '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase();
      }
      x++;
    }
  }
  return output;
}
*/

function openDiv(id)
{
	if(document.getElementById('open_div').value==1)
	{
		document.getElementById('open_div').value=0;
		document.getElementById(id).style.display = 'none';
	}
	else{
		document.getElementById('open_div').value=1;
		document.getElementById(id).style.display = 'block';
	}
}
