function loadPageurl(div,url)
{
	$("#"+div).loadIfModified(url); 	
}

function styleSwitch(_div)
{
	$('div[@id*=bar]').each(function(i) 
	{				
		if (this.getAttribute('id') == _div)
		{
			$(this).removeClass("functionbarUnFocus");   
			$(this).addClass("functionbarFocus");   
		}
		else
		{
			$(this).addClass("functionbarUnFocus");
		} 
		
	});
}

function loaddefault(_div)
{
	styleSwitch(_div);	
	$('#brandinfo').hide();
	$("#baseinfo").hide();	
	$("#defaultinfo").show();
}

function loadcmsarticle(_div,classid)
{
	$(_div).show();
	var url = "/hwyp/product/loadCmsArticle.asp?classid="+classid;
    $.post(url, {
    }, function(response){
        $(_div).fadeOut();
        setTimeout("finishRequest('"+_div+"', '"+escape(response)+"')", 500);
      });
    	return false;
}

function loadbaseinfo(_div,_barDiv,infotype,vid)
{
	styleSwitch(_barDiv);
    $('#loading').show();
	$('#defaultinfo').hide();
	$('#brandinfo').hide();
	$(_div).show();

	var url;

	if (infotype == "consultation")
	{
		url = "/hwyp/product/loadConsultation.asp?vid="+vid;
	}
	else
	{
		url  = "/hwyp/product/loadProdBaseInfo.asp?infotype="+infotype+"&vid="+vid;
	}

    $.post(url, {
    }, function(response){
        $(_div).fadeOut();
        setTimeout("finishRequest('"+_div+"', '"+escape(response)+"')", 500);
      });
    	return false;

}

function loadbrandinfo(_div,_barDiv)
{
	styleSwitch(_barDiv);
	$('#defaultinfo').hide();
	$('#baseinfo').hide();
	$('#brandinfo').show();
}

function loadRelated(_div,vid)
{
	$(_div).show();
	var url ;
	if (_div == "_rels")
	{
		url = "/hwyp/product/loadRelated.asp";
	}else if (_div == "_consultation")
	{
		url = "/hwyp/product/loadConsultation.asp";
	}else if (_div == "_thumbs")
	{
		url = "/hwyp/product/loadThumbs.asp";
	}else if(_div == "_pcomment")
	{
		url = "/hwyp/product/loadProdRelatedComment.asp";
	}

    $.post(url + "?vid="+vid, {
    }, function(response){
        $(_div).fadeOut();
        setTimeout("finishRequest('" + _div + "', '"+escape(response)+"')", 500);
      });
    	return false;

}

function finishRequest(id, response) 
{
  $('#loading').hide();
  $('#'+id).html(unescape(response));
  $('#'+id).fadeIn();
} 

