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 == "login")

	{

		/*var obj_zoom = document.getElementById('login_div2');

		obj_zoom.className='tdalpha';*/

		document.getElementById("login_div").style.display='block';

		

		var arr = p.split("***")

		

		var login = document.getElementById("login_id").value;

		var pass = document.getElementById("password_id").value;

		qstr = 'login=' + escape(login) + '&pass=' + escape(pass) + '&lang=' + escape(arr[0]) + '&url=' + escape(arr[1]);

		

	}

	if(idx=="order")

	{

		

		var obj_zoom = document.getElementById('prod_tbl');

		obj_zoom.className='tdalpha';

		

		/*

		var IE = document.all?true:false

		if (!IE) document.captureEvents(Event.MOUSEMOVE)

		var tempX = 0;

		var tempY = 0;

		  if (IE) 

		  {

		    tempX = event.clientX + document.documentElement.scrollLeft

		    tempY = event.clientY + document.documentElement.scrollTop

		  } 

		  else {

		    tempY = 500 + document.documentElement.scrollTop;

		  }  

		  if (tempX < 0){tempX = 0}

		  if (tempY < 0){tempY = 0}  

		  

		  var margin_top = (tempY-50)+'px';

		  var margin = margin_top+" 0px 0px 400px";

		  */

		 

		 var arr = p.split("***");

		 var p_id =  arr[0];

		 var lng_code = arr[1];

		 var count_prod =  document.getElementById("add_prod_count_id_"+p_id).value;

		 count_prod = parseInt(count_prod)

		

		 if(count_prod>0)

		 { 

				document.getElementById("buy_div_"+p_id).style.display = 'block';

		 }

		//document.getElementById('popup1').style.visibility='visible';

		//document.getElementById("middletd").className='tdalpha';



		qstr = 'x1=' + escape(p_id)+'&x2='+escape(lng_code)+'&x3='+escape(count_prod);  

		//qstr = 'x1=' + escape('kkk');	  



	}

	if(idx=="step")

	{

		var obj_zoom = document.getElementById('prod_tbl');

		obj_zoom.className='tdalpha';

		document.getElementById("login_div2").style.display='block';

		 var arr = p.split("***");

		 var p_id =  arr[0];

		 var lng_code = arr[1];

		qstr = 'x1=' + escape(p_id)+'&x2='+escape(lng_code);  

	

	}

	

	if(idx == "vote")

	{

		var obj_zoom = document.getElementById('prod_tbl');

		obj_zoom.className='tdalpha';

		document.getElementById("login_div3").style.display='block';

		

		var x1 = document.getElementById("pid").value;

		qstr = 'x1=' + escape(x1) + '&x2=' + escape(p);

	}

	

	

	

	if(idx=="info")

	{

		

		var obj_zoom = document.getElementById('prod_tbl');

		obj_zoom.className='tdalpha';

		

		 var ids = document.getElementById('prod_ids').value 

		 

		 var arr = p.split("***");

		 var p_id =  arr[0];

		 var lng_code = arr[1];

		 

		 

		 arr_ids = ids.split("***");

		 for(i=0; i<arr_ids.length;i++)

		 {

		 	if(document.getElementById('info_div_id_'+arr_ids[i])){

		 		document.getElementById('info_div_id_'+arr_ids[i]).innerHTML = ''; 

		 	}

		 }

		 

		 qstr = 'x1=' + escape(p_id)+'&x2='+escape(lng_code);  

	



	}

	/*if(idx=="category")

	{

		var x1 = document.getElementById("a_c").value;

		var x2 = document.getElementById("lang_code").value;

		qstr = 'x1=' + escape(x1) + '&x2=' + escape(x2);

	}*/



	return qstr;

}





function updatepage(str, idx,p)

{

	if(idx == "login")

	{

		//var obj_zoom = document.getElementById('zoom');

		//obj_zoom.className='tdvisible';

		document.getElementById("login_div").style.display='none';

		

		var arr = str.split("***")

		

		if(arr['0']==1)

		{

			window.location.href=arr[1];

		}

		else if(arr['0']==2 || arr['0']==3)

		{

			document.getElementById("error_str_id").innerHTML=arr['1'];

		}

		

	}

	

	if(idx == "order")

	{

		

		var obj_zoom = document.getElementById('prod_tbl');

		obj_zoom.className='tdnoalpha';

		

		 

		 var arr = p.split("***");

		 var p_id =  arr[0];

		 var lng_code = arr[1];

		 

		 

		 var div_disp = "buy_div_"+p_id;

		 document.getElementById("basket_count").innerHTML=str;

	

		/*

		document.getElementById('popup1').style.visibility='hidden';

		document.getElementById("middletd").className='tdnonalpha';

		document.getElementById("basket_count").innerHTML=str;*/

		

		 setTimeout("HiddenPopup('"+div_disp+"')",3000)

	}

	

	

	

	

	if(idx == "info")

	{

		

		var obj_zoom = document.getElementById('prod_tbl');

		obj_zoom.className='tdnoalpha';

		

		 

		 var arr = p.split("***");

		 var p_id =  arr[0];

		 var lng_code = arr[1];

		 

		

		document.getElementById("info_div_id_"+p_id).innerHTML=str;

		

		

	}

	

	

	if(idx == "vote")

	{

		

		var obj_zoom = document.getElementById('prod_tbl');

		obj_zoom.className='tdnoalpha';

		document.getElementById("login_div3").style.display='none';

		document.getElementById("votetd").innerHTML=str;

	}

	

	if(idx == "step")

	{

		var obj_zoom = document.getElementById('prod_tbl');	

		obj_zoom.className='tdnoalpha';

		document.getElementById("login_div2").style.display='none';

		

		document.getElementById("td_step").innerHTML=str;

		

	}



}

function basketDelivery()

{

	if(document.getElementById("countries_sel").value=='none'){

		var price = 0;

	}

	else{

	var price = parseInt(document.getElementById("countries_sel").value);}

	var total = parseInt(document.getElementById("total_id").value);

	

	var all_total = total+price;

	

	

	

	document.getElementById("delprice_td").innerHTML = number_format( price, '0', '.', ' ' );

	document.getElementById("totalprice_td").innerHTML = number_format( all_total, '0', '.', ' ' );

	

	

	

	

	if(document.getElementById("sale_memb"))

	{

		var percent = parseInt(document.getElementById("percent_sale_memb").value);

		//var member = parseInt(document.getElementById("sale_memb").value);

		var all_total2 = all_total-(all_total*percent/100);

		

		

		document.getElementById("sale_memb_td").innerHTML = number_format( all_total2, '0', '.', ' ' );

		//document.getElementById("totalprice_td").innerHTML = total+price;

	}

	

	if(document.getElementById("countries_sel").value!='none')

	{

		document.getElementById('cont_shop').style.display = 'block';

	}

	else{

		

		document.getElementById('cont_shop').style.display = 'none';

	}

}





function Clickheretoprint(lng_code)

{

		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>Smart Electronics</title><style> input { display:none; } body,td{font-size:10px} </style>');

			docprint.document.write('<link href="/styles/style.css" rel="stylesheet" type="text/css" />');

			if (lng_code=='am')

			{

				docprint.document.write('<link href="/styles/style_am.css" rel="stylesheet" type="text/css" />');

				

				

			}

			else

			{

				docprint.document.write('<link href="/styles/style_other.css" rel="stylesheet" type="text/css" />');

				

			}

			docprint.document.write('<link href="/styles/style.css" rel="stylesheet" type="text/css" /></head><body onLoad="self.print()" style="padding:0px;margin:0px">');

			docprint.document.write('<table cellpadding="0" cellspacing="0" width="100%" summary=""><tr><td style="background:#f8d820"><img src="/img/logo.png" alt="" ></td></tr><tr><td  style="padding:10px">');

			docprint.document.write(content_vlue);

			docprint.document.write('</td></tr></table><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 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 getquerystring(idx, p)

{

	if(idx == "vote")

	{

		document.getElementById("votetd").innerHTML='<img src="/images/loader.gif" alt="">';

		var x1 = document.getElementById("pid").value;

		qstr = 'x1=' + escape(x1) + '&x2=' + escape(p);

	}

	if(idx=="order")

	{

		var IE = document.all?true:false

		if (!IE) document.captureEvents(Event.MOUSEMOVE)

		var tempX = 0;

		var tempY = 0;

		  if (IE) 

		  {

		    tempX = event.clientX + document.documentElement.scrollLeft

		    tempY = event.clientY + document.documentElement.scrollTop

		  } 

		  else {

		    tempY = 500 + document.documentElement.scrollTop;

		  }  

		  if (tempX < 0){tempX = 0}

		  if (tempY < 0){tempY = 0}  

		  

		  var margin_top = (tempY-50)+'px';

		  var margin = margin_top+" 0px 0px 400px";

		document.getElementById("popup1").style.margin = margin;

		document.getElementById('popup1').style.visibility='visible';

		document.getElementById("middletd").className='tdalpha';



		qstr = 'x1=' + escape(p);

	}

	if(idx=="step")

	{

		qstr = 'x1=' + escape(p);

	}

	if(idx=="category")

	{

		var x1 = document.getElementById("a_c").value;

		var x2 = document.getElementById("lang_code").value;

		qstr = 'x1=' + escape(x1) + '&x2=' + escape(x2);

	}



	return qstr;

}

function updatepage(str, idx)

{

	if(idx == "category")

	{

		//var obj_zoom = document.getElementById('zoom');

		//obj_zoom.className='tdvisible';

		document.getElementById("a_s_td").innerHTML=str;

	}

	if(idx == "vote")

	{

		//var obj_zoom = document.getElementById('zoom');

		//obj_zoom.className='tdvisible';

		//document.getElementById("middletd").className='tdnonalpha';

		document.getElementById("votetd").innerHTML=str;

	}

	if(idx == "order")

	{

		document.getElementById('popup1').style.visibility='hidden';

		document.getElementById("middletd").className='tdnonalpha';

		document.getElementById("basket_count").innerHTML=str;

	}

	if(idx == "step")

	{

		//var obj_zoom = document.getElementById('zoom');

		//obj_zoom.className='tdvisible';

		document.getElementById("td_step").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 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 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 loadComboByQuery( chooseCategoryText, strQuery, comboId, selectedId, query2 )

{

	reqUrl =  '/ajax/ajaxQuery.php?query=' + strQuery;

	

	if( query2 != null )

	{

		reqUrl += '&query2=' + query2;

	}

	

	

	

	new Ajax.Request(  reqUrl , 

	{

		method: 'get',



		onSuccess: function(transport) 

	  	{

	  		// FIRST ROW - Choose category here

  			//$(comboId).options.length=1;

  			$(comboId).innerHTML= '';

  			var option = new Option( chooseCategoryText, 0,  ( ! selectedId ) ? 1 : 0 );

			$(comboId).options[0] = option;

			/// END OF FIRST ROW



	  		var longstring= transport.responseText;

			var brokenstring = longstring.split( "\r\n");



			var arrLength = brokenstring.length;



			var optG;

			

			//var asdf = '';

			var selectedInd = 0;

			var currSelectableIndex = 1;

						

			for( var i = 0; i < arrLength; i += 1 )

			{

				

				try

				{

					var dblBrokenString = brokenstring[i].split( ";,;");



					if( query2 == null )

					{

						

						var option = new Option(dblBrokenString[1], dblBrokenString[0] );

						

						

						//asdf += selectedId + ' ' + dblBrokenString[0] + ' ';

						

						if ( selectedId == dblBrokenString[0] )

						{

							selectedInd = currSelectableIndex;

						}

						

						 $(comboId).options[i + 1] = option;

						 

						 currSelectableIndex += 1;

					}

					else

					{

						//alert(selectedId);

					

						if( dblBrokenString[2] > 0 ) // optgroup

						{

							

							optG = document.createElement("optgroup");

							optG.label = dblBrokenString[1];

							

							$(comboId).appendChild(optG); //// ????

						}

						else // option

						{

							var option = new Option(dblBrokenString[1], dblBrokenString[0] );

							option.value = dblBrokenString[0];

							option.innerText = dblBrokenString[1];

							if(selectedId == dblBrokenString[0])

							{

								option.selected = true;

								selectedInd = currSelectableIndex;

							}

							optG.appendChild( option );

							

							currSelectableIndex += 1;

						}

					}

				}

				catch(e)

				{

					//alert(e.message);

				}

			}

			

			$(comboId).selectedIndex = selectedInd;

			

			if( selectedInd > 0 )

			{

				

				document.getElementById(comboId).onchange();

				//alert('aaa');

				//loadComboByQuery('SELECT brand_id AS id, brand_name AS name FROM brand WHERE brand_pid = 0  ', 'subBrand', 0) ;

			}

			

			

			

			

	  	}

	});

}



function setCookie(name, value, expDays) 

{

	

	var exp = new Date();     //set new date object

	var exp2 = new Date();     //set new date object

	if( expDays != null )

	{

		exp.setTime( exp.getTime() + (1000 * 60 * 60 * 24 * expDays) );

		exp2.setTime( exp.getTime() - 20000 );

		

	}

	document.cookie = name + "=" + escape(value) + "; path=/" + ((expDays == null) ? "" : "; expires=" + exp2.toGMTString() );

	document.cookie = name + "=" + escape(value) + "; path=/" + ((expDays == null) ? "" : "; expires=" + exp.toGMTString() );

	

}



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 getCookie( check_name ) {

	// first we'll split this cookie up into name/value pairs

	// note: document.cookie only returns name=value, not the other components

	var a_all_cookies = document.cookie.split( ';' );

	var a_temp_cookie = '';

	var cookie_name = '';

	var cookie_value = '';

	var b_cookie_found = false; // set boolean t/f default f

	

	for ( i = 0; i < a_all_cookies.length; i++ )

	{

		// now we'll split apart each name=value pair

		a_temp_cookie = a_all_cookies[i].split( '=' );

		

		

		// and trim left/right whitespace while we're at it

		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');

	

		// if the extracted name matches passed check_name

		if ( cookie_name == check_name )

		{

			b_cookie_found = true;

			// we need to handle case where cookie has no value but exists (no = sign, that is):

			if ( a_temp_cookie.length > 1 )

			{

				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );

			}

			// note that in cases where cookie is initialized but no value, null is returned

			return cookie_value;

			break;

		}

		a_temp_cookie = null;

		cookie_name = '';

	}

	if ( !b_cookie_found )

	{

		return null;

	}

}



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;

}





var count=1;

function Visiblepopup(id)

{

	var open_popup = document.getElementById('popup_open').value;

if (open_popup==1){

	document.getElementById(id).style.display = 'none';

	 document.getElementById('popup_open').value = 0;

	

}

else{

	document.getElementById(id).style.display = 'block';

	document.getElementById('popup_open').value = 1;

	

	}

}

*/



var count=0;

function Visiblepopup(id){

	if (count==0){

	document.getElementById(id).style.display = 'block';

	count++;

	}

    else{

		count--;

		document.getElementById(id).style.display = 'none';

		}



}





function DisplayPopup(id){

	

	document.getElementById(id).style.display = 'block';

	

}

function HiddenPopup(id){

	

	document.getElementById(id).style.display = 'none';



}

function ClearVal(id, name){

	

	if(document.getElementById(id).value==name){

		document.getElementById(id).value = '';}

}

function InnerNone(id)

{

	document.getElementById('info_div_id_'+id).innerHTML='';

}

function number_format( number, decimals, dec_point, thousands_sep ) {

   

 

    var n = number, prec = decimals, dec = dec_point, sep = thousands_sep;

    n = !isFinite(+n) ? 0 : +n;

    prec = !isFinite(+prec) ? 0 : Math.abs(prec);

    sep = sep == undefined ? ',' : sep;

 

    var s = n.toFixed(prec),

        abs = Math.abs(n).toFixed(prec),

        _, i;

 

    if (abs > 1000) {

        _ = abs.split(/\D/);

        i = _[0].length % 3 || 3;

 

        _[0] = s.slice(0,i + (n < 0)) +

              _[0].slice(i).replace(/(\d{3})/g, sep+'$1');

 

        s = _.join(dec || '.');

    } else {

        s = abs.replace('.', dec_point);

    }

return s;

}

function SetDisplay(id,id2)

{

	var combo_val = document.getElementById(id2).value;

	if(combo_val==33)

	{

		 document.getElementById(id).style.display='none'

	}

	else

	{

		document.getElementById(id).style.display='block'

	}

}

function SetDisplayAster()

{

	if(document.getElementById('no_comp').checked)

	{

		document.getElementById('add_aster').style.display='none';

		document.getElementById('phone_aster').style.display='none';

	}

	else{

		document.getElementById('add_aster').style.display='block';

		document.getElementById('phone_aster').style.display='block';

	}

}



function checkedCount(id,str)

{

	var cnt = document.getElementById('comp_div_count_id').value;

	

	

	

	if(document.getElementById(id).checked)

	{

		cnt++;

	}

	else{

		cnt--;

	}



	

	

	if(cnt>=0)

	{

		//alert(document.getElementById('compare_button_id').value)

		//alert(str)

		document.getElementById('compare_button_id').value = str+" ("+cnt+")";

	}

	

	document.getElementById('comp_div_count_id').value=cnt;

}



function openDiv(id)

{

	var ids = document.getElementById('faq_ids').value;

	

	var ids_arr = ids.split('***')

	

	for(i=0;i<ids_arr.length;i++)

	{

		if(document.getElementById('faq_'+ids_arr[i]))

		{

			document.getElementById('faq_'+ids_arr[i]).style.display='none'

		}

	}

	document.getElementById('faq_'+id).style.display='block'

}



function ShowPhoto(photoname, w, h) {

	url = "/showphoto.php?img="+photoname;



	Win=window.open(url, 'viewPhoto',  'toolbar=0,scrollbars=0,location=0,directories=0,status=0,menubar=0,resizable=0,width='+w+',height='+h+',border=thin,top=50,left=50,help=0');

	Win.focus();

}
