/**
* @author Mikhail Starovojt
* @author Irina Miroshnichenko
*/
var MstarGeneral=function (data) {
};


MstarGeneral.prototype.ShowHideElement = function (NewState)
{
	var elements = document.documentElement.getElementsByTagName('select');
	for (var i=0; i<elements.length; i++) {
		elements[i].style.visibility = NewState;
	}
};

/**
* Add option to the current select in the client side
*
* @param int selectId - id of select element
* @param String txt - text of option
* @param String val - value of option
*/
MstarGeneral.prototype.AddOption = function(selectId, txt, val){
	var objOption = new Option(val, txt, false, false);
	document.getElementById(selectId).options.add(objOption);
}

/**
* Clear select
*
* @param int selectId - id of select element
*/
MstarGeneral.prototype.ClearAllOption = function(selectId){
	document.getElementById(selectId).length=0;
}

MstarGeneral.prototype.ChangeProductImage = function(Id,SubId,ImageMiddle,ImageOriginal)
{
	document.getElementById('ctl00_ContentMainPage_imgMainImage').src=ImageMiddle;
	document.getElementById('left_big_image').src=ImageOriginal;
}

MstarGeneral.prototype.GetBrowserInfo = function()
{
	var t,v = undefined;
	if (window.opera) t = 'Opera';
	else if (document.all) {
		t = 'IE';
		var nv = navigator.appVersion;
		var s = nv.indexOf('MSIE')+5;
		v = nv.substring(s,s+1);
	}
	else if (navigator.appName) t = 'Netscape';
	return {type:t,version:v};
}

MstarGeneral.prototype.Bookmark = function(a)
{
	var url = window.document.location;
	var title = window.document.title;
	var b = oMstarGeneral.GetBrowserInfo();
	if (b.type == 'IE' && b.version >= 4) window.external.AddFavorite(url,title);
	else if (b.type == 'Opera') {
		a.href = url;
		//a.rel = "sidebar";
		a.title = url+','+title;
		return true;
	}
	else if (b.type == "Netscape") window.sidebar.addPanel(title,url,"");
	else alert("Нажмите CTRL-D, чтобы добавить страницу в закладки.");
	return false;
}

MstarGeneral.prototype.ToggleLeftMenu = function(sSection)
{
	document.getElementById('brand_span').style.display = 'none';
	document.getElementById('assortment_span').style.display = 'none';
	document.getElementById('extended_search_span').style.display = 'none';

	document.getElementById('brand_link').className = '';
	document.getElementById('assortment_link').className = '';
	document.getElementById('extended_search_link').className = '';

	if (sSection=='brand') {
		document.getElementById('brand_span').style.display = 'block';
		document.getElementById('brand_link').className = 'sel';
	}else if (sSection=='assortment') {
		document.getElementById('assortment_span').style.display = 'block';
		document.getElementById('assortment_link').className = 'sel';
	} else if (sSection=='extended_search') {
		document.getElementById('extended_search_span').style.display = 'block';
		document.getElementById('extended_search_link').className = 'sel';
	}
	//alert('section:'+sSection);
}


MstarGeneral.prototype.ToggleBigImage = function()
{
	if (document.getElementById('big_image_table').style.display=='none') {
		document.getElementById('big_image_table').style.display='';
		document.getElementById('left_column_td').style.display='none';
		document.getElementById('preview_product_span').style.display='none';

	}else {
		document.getElementById('big_image_table').style.display='none';
		document.getElementById('left_column_td').style.display='';
		document.getElementById('preview_product_span').style.display='';
	}

}

var oMstarGeneral=new MstarGeneral();