﻿// JScript File
 function OpenWindow(Url) {     
    window.open(Url);        
   } 
function NewWindow(url,vHeight,vWidth)
{
   winDef = 'status=no,resizable=no,scrollbars=no,toolbar=no,location=no,fullscreen=no,titlebar=yes,height='.concat(vHeight).concat(',').concat('width=').concat(vWidth).concat(',');
   winDef = winDef.concat('top=').concat((screen.height - vHeight)/2).concat(',');
   winDef = winDef.concat('left=').concat((screen.width - vWidth)/2);
   newWin = window.open(url, '_blank', winDef);
   newWin.focus();               
}       

function PrintSubject()
    {  
	   	w=open();
	    w.document.writeln('<html>');
	    w.document.writeln('<head>');
	    w.document.writeln('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">');
	    w.document.writeln('<link  href="App_Themes/Default1/default.css" rel="stylesheet" type="text/css"/>  ');
	    w.document.writeln('<style>.Footer_Text_Link{color:#000;font-size:11px;}</style>  ');    	    
	    w.document.writeln('</head>');
	    w.document.writeln('<body topmargin=3 leftmargin=0 marginheight=3 marginwidth=0>');
	    w.document.writeln('<table cellspacing=0 cellpadding=0 border=0 width=600 align=center>');
	    w.document.writeln('<tr>');
	    w.document.writeln('<td>');
	    w.document.writeln('<img src ="App_Themes/Default1/Images/logo.gif" alt="" style="border:0;" align="asbmiddle"/>');
	    w.document.writeln('</td>');
	    w.document.writeln('</tr>');
	    w.document.writeln('<tr>');
	    w.document.writeln('<td valign="top" >');	    
	    
	    w.document.writeln('<a onclick="javascript:location.reload(true);window.print();" style=" cursor:hand" class="Paging">');
	    w.document.writeln('<img src="App_Themes/Default1/Images/print.gif" />');	
	    w.document.writeln('  Print this page');
	    w.document.writeln('</a></td>');	    
	    w.document.writeln('</tr>');
	    w.document.writeln('<tr>');
	    w.document.writeln('<td valign="top" >');	    
	    w.document.writeln(document.getElementById('Content').innerHTML);	    	    
	    w.document.writeln('</td>');
	    w.document.writeln('</tr>');
	    w.document.writeln('<tr>');
	    w.document.writeln('<td style="padding-top:20px;" class="BoxFooter">');	    
	    w.document.writeln(document.getElementById('BoxFooter').innerHTML);	    	    
	    w.document.writeln('</td>');
	    w.document.writeln('</tr>');	    
	    w.document.writeln('</table>');
	    w.document.writeln('</body>');
	    w.document.writeln('</html>');
	    w.document.title = document.title;	   
	    return false; 
    }
    function PrintProduct()
    {  
	   	w=open();
	    w.document.writeln('<html>');
	    w.document.writeln('<head>');
	    w.document.writeln('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">');
	    w.document.writeln('<link  href="default.css" rel="stylesheet" type="text/css"/>  ');
	    w.document.writeln('</head>');
	    w.document.writeln('<body topmargin=3 leftmargin=0 marginheight=3 marginwidth=0>');
	    w.document.writeln('<table cellspacing=0 cellpadding=0 border=0 width=600 align=center>');
	    w.document.writeln('<tr>');
	    w.document.writeln('<td colspan="2">');
	    w.document.writeln('<img src ="images/logo.gif" alt="" style="border:0;" align="asbmiddle"/>');
	    w.document.writeln('</td>');
	    w.document.writeln('</tr>');
	    w.document.writeln('<tr>');
	    w.document.writeln('<td colspan="2" valign="top" >');	    
	    
	    w.document.writeln('<a onclick="javascript:location.reload(true);window.print();" style=" cursor:hand" class="Paging">');
	    w.document.writeln('<img src="Images/print.gif" />');	
	    w.document.writeln('  Print this page');
	    w.document.writeln('</a></td>');	    
	    w.document.writeln('</tr>');
	    w.document.writeln('<tr>');
	    w.document.writeln('<td valign="top" width="40%" >');	    
	    w.document.writeln(document.getElementById('Content').outerHTML);	    	    
	    w.document.writeln('</td>');
	    w.document.writeln('<td valign="top" >');	    
	    w.document.writeln(document.getElementById('Content1').outerHTML);	    	    
	    w.document.writeln('</td>');
	    w.document.writeln('</tr>');
	    w.document.writeln('<tr>');
	    w.document.writeln('<td colspan="2" style="padding-top:20px;">');	    
	    w.document.writeln(document.getElementById('BoxFooter').outerHTML);	    	    
	    w.document.writeln('</td>');
	    w.document.writeln('</tr>');	    
	    w.document.writeln('</table>');
	    w.document.writeln('</body>');
	    w.document.writeln('</html>');
	    w.document.title = document.title;	   
	    return false; 
    }
    function FitPic(w) {         
       var i=0;       
       if (navigator.appName == 'Netscape') 
         i=-10;       
       if (w.document.images[0]) w.window.resizeTo(w.document.images[0].width, w.document.images[0].height + 50 - i);      w.self.focus();
       alert('ok');
     }
   function PopupPic(sPicURL, w, h) {         
   	    ww=open('_blank','popupWindow','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=' + w + ',height=' + h + ',screenX=150,screenY=150,top=150,left=150');   	    
	    ww.document.writeln('<html>');
	    ww.document.writeln('<head>');
	    ww.document.writeln('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">');	    
	    ww.document.writeln('</head>');
	    ww.document.writeln('<body topmargin=3 leftmargin=0 marginheight=3 marginwidth=0 onclick="javascript:window.close();">');
	    ww.document.writeln('<img src ="'+sPicURL+'" width="'+w+'" height="'+h+'" alt="" style="border:0;" align="asbmiddle" />');
	    ww.document.writeln('</body>');
	    ww.document.writeln('</html>');	    
	    ww.document.title = document.title;	   
	    return false; 
   } 
   function CleanFrom() { 
    document.getElementById("form1").reset();
   }   
   
  

function OpenWindow(url,vHeight,vWidth)
{
   winDef = 'status=no,resizable=no,scrollbars=no,toolbar=no,location=no,fullscreen=no,titlebar=yes,height='.concat(vHeight).concat(',').concat('width=').concat(vWidth).concat(',');
   winDef = winDef.concat('top=').concat((screen.height - vHeight)/2).concat(',');
   winDef = winDef.concat('left=').concat((screen.width - vWidth)/2);
   newWin = window.open(url, '_blank', winDef);
   newWin.focus();               
}     

  
PositionX = 200;
PositionY = 10;
// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)

defaultWidth  = 500;
defaultHeight = 500;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows

var AutoClose = true;

// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
function popImage(imageURL,imageTitle)
{
    if (imageTitle=='') imageTitle = 'Popup Image';
    if (isNN){imgWin=window.open('about:blank','',optNN);}
    if (isIE){imgWin=window.open('about:blank','',optIE);}
    with (imgWin.document)
    {
        writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
        writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
        writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
        writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
        writeln('width=document.images[0].width;');
        writeln('height=100-(document.body.clientHeight-document.images[0].height);');//writeln('height=100-(document.body.clientHeight-document.images[0].height);');
        writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
        writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
        writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
        if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
        else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close();" onclick="self.close();">');
        writeln('<img name="George" src='+imageURL+' style="display:block" onclick="javascript:self.close();"></body></html>');
        close();		
  }
}
/*========================================Slide Show=====================================*/

var iTransaction = 1
	var t = -1
	var w = 0
	var h = 0
   	function loadImage(arrImg)
	{
        t = t + 1;   

		if(t >	arrImg.length - 1)
		{
			t = 0;			
		}		
		
		
		
		var arrTitle = Title.split(",");
		showImage(arrImg[t], arrTitle[t]);
	}
    function showImage(linkImage, title)
    {
        var TransitionEffect = document.getElementById('VNVN_17_UC_SlideShow_h_ImageStyleEffect');
        var Img_Link = document.getElementById( 'Img_ID' );
        var Title_Link = document.getElementById( 'Title_ID' );
        
        if((w>0) && (h>0))
        {
            Img_Link.width = w;
            Img_Link.height = h;
        }
        
        var browserName = navigator.appName;
        //alert(browserName);
        if(browserName == 'Microsoft Internet Explorer')
        {
            //alert(browserName);
		    Img_Link.filters.item(0).apply();        
            //--------------------------------------------            
            if(TransitionEffect.value == 0)
            {
                iTransaction = Math.round(Math.random() * (23 - 1)) + 1 ;
                Img_Link.filters.revealTrans.transition = iTransaction; 
            }
            else
            {
                Img_Link.filters.revealTrans.transition = TransitionEffect.value; 
            }    
            
            //---------------------------------------------                
            Img_Link.filters.item(0).play();
        }
        //Filter();
        Img_Link.src = linkImage.replace("~/","./");
        Title_Link.innerHTML="Dung";//title;
        alert(Title_Link.innerHTML);
        
    }
	
	function StopTimer()
	{
		window.clearInterval(timer);
	}
	function setSize()
	{
	}    
   
    function getToArray(str)
    {
		mycars = str.split(",");	
	}
	function getarrImage()
	{
	    var hf = document.getElementById('VNVN_17_UC_SlideShow_h_arrImage');
	    getToArray(hf.value);
	    loadImage(mycars);
	}
	var mycars = new Array();
	var times=3000;
	function StartTimer(time, imagewidth, imageHeight)
	{
	    //Khong dung slide show
		//timer = window.setInterval( getarrImage , time );
		if((imagewidth > 0) && (imageHeight>0))
		{
		    w = imagewidth;
		    h = imageHeight;
		}		
		times=time;
	}	         
	function go() 
	{ 
        Egg1.filters[0].Apply();

        if (Egg1.style.visibility == "visible") 
        { 
        Egg1.style.visibility = "hidden"; 
        Egg1.filters.revealTrans.transition=12; 
        } 
        else 
        { 
        Egg1.style.visibility = "visible"; 
        Egg1.filters[0].transition=12; 
        } 
        Egg1.filters[0].Play(); 
    }   
    function Bt_First_Click()
    {
        var Img_ID = document.getElementById('Img_ID');        
        var hf = document.getElementById('VNVN_17_UC_SlideShow_h_arrImage');
	    getToArray(hf.value);
	    t=0;          
        Img_ID.src = mycars[t].toString().replace("~/","./");                 
        Display(t);
    }  
    function Bt_Back_Click()
    {
        var Img_ID = document.getElementById('Img_ID');        
        var hf = document.getElementById('VNVN_17_UC_SlideShow_h_arrImage');
	    getToArray(hf.value);
        if ( t > 0 )
            t = t - 1;
        else
            t=mycars.length-1;     
        Img_ID.src = mycars[t].toString().replace("~/","./");                   
        Display(t);
    }
    function Bt_Next_Click()
    { 
	     var Img_ID = document.getElementById('Img_ID');        
        var hf = document.getElementById('VNVN_17_UC_SlideShow_h_arrImage');
	    getToArray(hf.value);
        if ( t <mycars.length )
            t = t + 1;
        else
            t=0;     
        Img_ID.src = mycars[t].toString().replace("~/","./");
        Display(t);
    }
     function Bt_Last_Click()
    {
        var Img_ID = document.getElementById('Img_ID');        
        var hf = document.getElementById('VNVN_17_UC_SlideShow_h_arrImage');
	    getToArray(hf.value);          
	    t=mycars.length-1;
        Img_ID.src = mycars[t].toString().replace("~/","./");             
        Display(t);
    }  
    function Display(t)
    {        
	    var hdnTitle = document.getElementById('VNVN_17_UC_SlideShow_h_arrTitle');
		var Title=hdnTitle.value;           
		var Title_ID = document.getElementById('Title_ID');  
		Title_ID.innerHTML= Title.split(",")[t].toString();     		
    }  
    
    function Clear_Form()
	{	    
	    document.getElementById("form1").reset();
	}
    function Counter(field, countfield, maxlimit) 
    {           
        //alert (maxlimit);
        if (field.value.length > maxlimit)	{	            
            field.value = field.value.substring(0, maxlimit);
        }            
        else { 
            countfield.value = maxlimit - field.value.length;
        }     
    }
