// Özgür 10.05.2006
// TODO: Pathler konusunda bişi yapılabilir mi?
// Neotitans 2010-Oct-23: Merged with form.js

function showDiv(eSrc)
{
	//document.getElementById("divdetail").style.display = "none";
	document.getElementById("divadditional").style.display = "none";
	document.getElementById("divfamily").style.display = "none";
	document.getElementById("divcustomize").style.display = "none";
	document.getElementById(eSrc).style.display = "block";
}

function hidediv(x) {
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById(x).style.visibility = 'hidden';
}
else {
if (document.layers) { // netscape 4
document.x.visibility = 'hidden';
}
else { // IE 4
document.all.x.style.visibility = 'hidden';
}
}

var myform = document.getElementById("frm_src");
if (myform!=null)
{
	if (myform.cat_id!="") myform.cat_id.style.visibility='visible';
}
}

function showdiv(x) {
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById(x).style.visibility = 'visible';
}
else {
if (document.layers) { // netscape 4
document.x.visibility = 'visible';
}
else { // IE 4
document.all.x.style.visibility = 'visible';
}
}

var myform = document.getElementById("frm_src");
if (myform!=null)
{
	if (myform.cat_id!="") myform.cat_id.style.visibility='hidden';
}
}

function togglediv(x) {
  document.getElementById(x).style.display='block';
}

function inlinediv(x) {
  document.getElementById(x).style.display='none';
}

function setActiveDiv(index) {
	var obj;
	for (i=0;i<20;i++)
	{
		obj = document.getElementById("div_option_"+i);
		if (obj)
		{
			obj.style.display='none';
			if (document.getElementById("div_option_spec_"+i))
				document.getElementById("div_option_spec_"+i).style.display='none';
			if (document.getElementById("div_option_finish_"+i))
				document.getElementById("div_option_finish_"+i).style.display='none';
			if (document.getElementById("div_option_color_"+i))
				document.getElementById("div_option_color_"+i).style.display='none';
		}
	}
	document.getElementById("div_option_"+index).style.display="block";
	if (document.getElementById("div_option_spec_"+index))
		document.getElementById("div_option_spec_"+index).style.display='block';
	if (document.getElementById("div_option_finish_"+index))
		document.getElementById("div_option_finish_"+index).style.display='block';
	if (document.getElementById("div_option_color_"+index))
		document.getElementById("div_option_color_"+index).style.display='block';

	document.getElementById("combo_color").value="0";
	document.getElementById("combo_finish").value="0";
	if (document.getElementById("finish_id_"+index))
		document.getElementById("finish_id_"+index).selectedIndex=0;
	if (document.getElementById("color_id_"+index))
		document.getElementById("color_id_"+index).selectedIndex=0;
}

/***** form.js contents below *****/
function resetValue(obj) {
	var value = obj.value;
	if (value=="Keyword Or Item #") {
		obj.value="";
	}
}

function checkcolor(x)
{
    var alertit = false;
    if (x=="0") {
        alertit = true;
        for (i=0;i<20;i++) {
            obj = document.getElementById("div_option_colorh_"+i);
            if (obj) {
                if (obj.style.display=='block') {
                    if (document.getElementById("color_id_"+i).options.length==1)
                        alertit = false;
                }
            }
        }
    }

    if (alertit == true) {
        alert('Please select a color option');
        return false;
    }
    else
        return true;
}

function checkfinish(x)
{
    var alertit = false;
    if (x=="0") {
        alertit = true;
        for (i=0;i<20;i++) {
            obj = document.getElementById("div_option_finish_"+i);
            if (obj) {
                if (obj.style.display=='block') {
                    if (document.getElementById("finish_id_"+i).options.length==1)
                        alertit = false;
                }
            }
        }
    }

    if (alertit == true) {
        alert('Please select a finish option');
        return false;
    }
    else
        return true;
}

function dofillOrder1(f) {
if (f.chk_order_a.checked) {
  f.txt_1_7.value=document.frm_order1.txt_1_4.value;
  f.txt_1_8.value=document.frm_order1.txt_1_5.value;
  f.txt_1_9.value=document.frm_order1.txt_1_6.value;
  f.combo_6.selectedIndex=document.frm_order1.combo_4.selectedIndex;
  f.combo_7.selectedIndex=document.frm_order1.combo_5.selectedIndex;

  myOption=0;
  for (i=f.rad_adr_billing.length-1; i > -1; i--)
  {
    if (f.rad_adr_billing[i].checked)
    {
        myOption = i; i = -1;
    }
  }
  f.rad_adr_shipping[myOption].checked = true;
}
}

/***** tab.js contents below *****/
function selTab(index) {
	document.getElementById("tab1").className="tab_1_n";
	document.getElementById("tab2").className="tab_1_n";
	document.getElementById("tab3").className="tab_1_n";
	document.getElementById("tab4").className="tab_1_n";
	document.getElementById("tab5").className="tab_1_n";
	document.getElementById("tab_content1").className="tab_content_1_n";
	document.getElementById("tab_content2").className="tab_content_1_n";
	document.getElementById("tab_content3").className="tab_content_1_n";
	document.getElementById("tab_content4").className="tab_content_1_n";
	document.getElementById("tab_content5").className="tab_content_1_n";
	document.getElementById("tab"+index).className="tab_1";
	document.getElementById("tab_content"+index).className="tab_content_1";
}

/***** pop.js contents below *****/
function popUp( sname, site_name, width, height ) {
 x=window.open( sname ,site_name,"toolbar=no,location=no,top=0,left=0,directories=no,status=no,resizable=yes,menubar=no,location=no,scrollbars=1,width=" + width + ",height=" + height);
 x.focus();
}

