/*
 *  产品库专用JS
 *  BY P.L.R  17:41 2010-10-28
*/


/**全局PNG背景透明 
 * correctly handle PNG transparency in Win IE 5.5 & 6.
 */

function correctPNG()  
{  
	if(navigator.appVersion.indexOf("MSIE")){
	 var arVersion = navigator.appVersion.split("MSIE");
     var version = parseFloat(arVersion[1]);
     if (version < 8)
     {
        
       for(var j=0; j<document.images.length; j++)
       {
           var img = document.images[j];
           var imgName = img.src.toUpperCase();
           if (imgName.substring(imgName.length-3, imgName.length) == "png")
           {
             var imgID = (img.id) ? "id='" + img.id + "' " : "";
             var imgClass = (img.className) ? "class='" + img.className + "' " : "";
             var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
             var imgAlt = (img.alt) ? "alt='" + img.alt + "' " : "alt='" + img.title + "' ";
             var imgStyle = "display:inline-block;" + img.style.cssText;
             if (img.align == "left") imgStyle = "float:left;" + imgStyle;
             if (img.align == "right") imgStyle = "float:right;" + imgStyle;
             if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
             var strNewHTML = "<span " + imgID + imgClass + imgTitle +  " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'" + img.src + "\', sizingMethod='scale');\"></span>";
             img.outerHTML = strNewHTML;
             j = j-1;
           }
       }
     }
    }    
}


function do_dearch(val)
{
	
	if($.trim(val)=="")
	{
		alert("请输入搜索关键字！");
		return false;
	}else{
		location.href="http://www.oppo.com/?q=search&search="+encodeURIComponent(val);
	}
}

function get_service_data(data_url2)
{
	
var no_data		=	"<li>暂时没有数据...</li>";  
//var data_url	=	"http://www.me.oppo.com/json.json";
var data_url	=	data_url2;

$.getJSON(data_url,{param:"oppo"},function(data){  
  	if(data.downloads){
  		$("#downloads").html("");
  		
		$.each(data.downloads,function(idx,item){   
       		if(typeof(item) == 'undefined'){return true;}else{
       			
	       	 	$("#downloads").append("<li><a href='"+item.url+"' title='"+item.title+"' target='_blank'>"+item.title+"</a>"+item.date+"</li>" );
	       	 }
        });
	}else{
		$("#downloads").html(no_data);
	}  
    
    if(data.news){
  		$("#news").html("");
		$.each(data.news,function(idx,item){   
       		if(typeof(item) == 'undefined'){return true;}
       		$("#news").append("<li><a href='"+item.url+"' title='"+item.title+"' target='_blank'>"+item.title+"</a>"+item.date+"</li>");
        });
	}else{
		$("#news").html(no_data);
	} 
	
	if(data.threads){
  		$("#threads").html("");
		$.each(data.threads,function(idx,item){   
       		if(typeof(item) == 'undefined'){return true;}
       		$("#threads").append("<li><a href='http://lt.oppo.com/viewthread.php?tid="+item.tid+"' title='"+item.title+" by "+item.author+"' target='_blank'>"+item.title+"</a>"+item.date+"</li>");
        });
	}else{
		$("#threads").html(no_data);
	} 
	     
}); 
    
}
	 

