﻿// JScript File

function trove()
{
    window.history.back();
}
/*
function hien_an_submenu(o)
	{
		var oj = document.getElementById(o);
		if(oj.style.display == 'block')
		{
			oj.style.display = 'none';
		}
		else
		{
			oj.style.display = 'block';
		}
	}
	
	function change_color(o,str_mau)
	{		
		o.style.color=str_mau;	
	}
	*/
	
	function timkiemsp(oSearch)
	{
	    var tb_search = document.getElementById(oSearch);
	    var path = "Search.aspx?ref=" + tb_search.value;
	    window.location.href= path;
	    
	   // alert(o.href);
	}
	
	function openImageNews(imgsrc,width,height)
	{
	    var owin = window.open('about:blank',null,"width = "+width + ", height=" +height + ", resizable=yes " );
	    var doc= owin.document.body;
	    doc.innerHTML ="<DIV><img src='"+ imgsrc+ "' id='img1' alt='' /></DIV>";
	   //alert("<DIV><img src='"+ imgsrc+ "' id='img1' /></DIV>");
	}
	
function MM_GetTitleVN()
{
    var vtd = window.location.href.lastIndexOf("/")+1;
    var vtc = window.location.href.lastIndexOf(".");
    var o = window.location.href.substring(vtd,vtc);
    var title= "Home";
    //alert(o);
    switch(o){
    case "Default":
         title = "Trang chủ";
         break;
    case "Introduction":
        title = "Giới thiệu";
        break;
    case "ProductList":
        title = "Sản phẩm";
        break;
    case "ProductDetails":
        title = "Thông tin sản phẩm";
        break;        
    case "News":
        title = "Tin tức";
        break;
    case "NewDetail":
        title = "Chi tiết tin tức";
        break;
    case "Service":
        title = "Mua bán - Gia công";
        break;
    case "Contact":   
        title = "Liên hệ";
        break;
    default:
        title = "Trang chủ";
        break;
    
    }
    
    var idtitle = document.getElementById('sp_title');
    idtitle.innerHTML = title;
    //alert(idtitle.innerText);
}


	function checkYahooOnline(yahooID)
	{ 
		var status;
		if (yahooID !='')
			status = '<div align="center"><img border="0" src="http://opi.yahoo.com/online?u='+yahooID+'&m=g&t=2"/></div>';
		document.write(status);
	}
	function checkSkype(SkypeID){
	    var status;
		if (SkypeID !='')
		    status = '<div align="center"><a href="skype:'+ SkypeID +'?chat"><img src="http://mystatus.skype.com/smallclassic/'+ SkypeID +' " style="border: none;" width="114" height="20" alt="My status" /></a></div>';
        document.write(status);
	}
	
	function checkimage(ctr)
	{
	   //var ctr = document.getElementById(ob);
	   //alert(ctr.src);
	   //alert(ctr.width);
	   if(ctr.width > 155)
	   {
	   
//	        if( (ctr.width)*2 <= ctr.height)
//	        {
//	           // alert("chu nhat");
//	            ctr.className="showImg_chunhat";
//	        }
//	        else
//	        {
	            //alert("vuong");
	            ctr.className="showImg_chunhat";//"showqImg_vuong";
	      //  }
	   }
	   else{
	    //alert("goc");
	    ctr.className="showqSrcImg_goc";
	   }
	    
	}
	
	function checkimage_PCCC(ctr)
	{
	   //var ctr = document.getElementById(ob);
	   //alert(ctr.src);
	   //alert(ctr.width);
	   if(ctr.width > 80)
	   {
	   
//	        if( (ctr.width)*2 <= ctr.height)
//	        {
//	           // alert("chu nhat");
//	            ctr.className="showImg_chunhat_PCCC";
//	        }
//	        else
//	        {
	           // alert("vuong");
	            ctr.className="showImg_chunhat_PCCC";//"showqImg_vuong_PCCC";
	       // }
	   }
	   else{
	    //alert("goc");
	    ctr.className="showqSrcImg_goc_PCCC";
	   }
	    
	}
