// JavaScript Document
/* ----- Code by: boy_infotech ---- */
if (window.parent!=window){ 
	alert('Trang web ban dang vao khong phai la website chinh thuc cua Vatgia.com.');
	window.open(location.href, '_top', '');
}


function change_description(id_show, id_data){
	document.getElementById(id_show).innerHTML = document.getElementById(id_data).innerHTML;
}

function change_class(id_hide, id_show, num_record){
	for(i=1; i<=num_record; i++){
	eval("document.all." + id_hide + i + ".className='text_tab_1'");
	}
	eval("document.all." + id_show + ".className='text_tab_2'");
}

function changeClass(id, classN){
	document.getElementById(id).className = classN;
}

function user_history(){
	if(document.getElementById("show_user_history_content").className == 'show_user_history_content_open'){
		changeClass('show_user_history_content', 'show_user_history_content_close');
		document.getElementById("show_user_history_image").src = "/images/downarrow.png";
	}
	else{
		changeClass('show_user_history_content', 'show_user_history_content_open');
		document.getElementById("show_user_history_image").src = "/images/uparrow.png";
	}
}

function change_class_news(id_hide, id_show, num_record){
	for(i=1; i<=num_record; i++){
	eval("document.all." + id_hide + i + ".className='text_tab_news_1'");
	}
	eval("document.all." + id_show + ".className='text_tab_news_2'");
}

function change_tab(id_tab, num_data, arrId, arrClass, id_show, id_data){
	for(i=0; i<num_data; i++){
		for(j=0; j<arrId.length; j++){
			document.getElementById(arrId[j] + i).className = "";
		}
	}
	for(i=0; i<arrId.length; i++){
		document.getElementById(arrId[i] + id_tab).className = arrClass[i];
	}
	if(id_show != "" && id_data != ""){
		document.getElementById(id_show).innerHTML = document.getElementById(id_data).innerHTML;
	}
}

function open_teaser(id_close, id_open, id_nut_open, id_nut_close){
	document.getElementById(id_close).style.display = "none";
	document.getElementById(id_nut_open).style.display = "none";
	document.getElementById(id_open).style.display = "inline";
	document.getElementById(id_nut_close).style.display = "inline";
}

function close_teaser(id_close, id_open,id_nut_open, id_nut_close){
	document.getElementById(id_open).style.display = "none";
	document.getElementById(id_nut_close).style.display = "none";
	document.getElementById(id_close).style.display = "inline";
	document.getElementById(id_nut_open).style.display = "inline";
}

function show_picture(type, picture){
	window.open('/home/showpicture.php?type=' + type + '&picture=' + picture,'','scrollbars=yes,resizeable=1,width=300,height=300')
}
/* ----- End code by: boy_infotech ---- */

// dinhtoan1905@yahoo.co.uk code
function SetViewTableDiv(tableName)
{
    var str = document.getElementById(tableName + 'Loc').style.display;
    if (str == 'block')
    {
        document.getElementById(tableName + 'Loc').style.display = "none";
        document.getElementById(tableName).src = "/css1/AdImgDown.gif";
    }
    else
    {
        document.getElementById(tableName + 'Loc').style.display = "block";
        document.getElementById(tableName).src = "/css1/AdImgUp.gif";
    }
    
}
function tab_page(select_id,count_tab){
	for(i=1;i<=count_tab;i++){
		document.getElementById("text_page_"+i).style.display='none';
		document.getElementById("tab_page_"+i).className='';
	}
		document.getElementById("text_page_"+select_id).style.display='inline';
		document.getElementById("tab_page_"+select_id).className='bg_tab_select';
}
// end dinhtoan1905@yahoo.co.uk code
function save_cookie(cookie_name, cookie_value){
	document.cookie = cookie_name + "=" + cookie_value;
}

function getCookie(c_name){
	if(document.cookie.length>0){
		c_start=document.cookie.indexOf(c_name + "=");
		if(c_start!=-1){ 
			c_start=c_start + c_name.length+1;
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1) c_end=document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
		}
	}
	return "";
}