
function open_large_image(url) {
    var  new_url, name, features, new_window;
    new_url = "http://www.freeblinds.com/show_image.php?file=" + url;
    name = "Product_Image";
    features = "width=400,height=550,fullscreen=no,location=no,resizable=yes,status=no,scrollbars=yes,toolbar=no";
    new_window = window.open(new_url, name,features);
    new_window.focus();

}


function openColorSamplePopup(url,option) {
    var  new_url, name, features, new_window;
    new_url = "http://www.freeblinds.com/popup.php?file=" + url+ "&op=" + option;
    name = "Option_Sample";
    features = "width=400,height=550,fullscreen=no,location=no,resizable=yes,status=no,scrollbars=auto,toolbar=no";
    new_window = window.open(new_url, name,features);
    new_window.focus();

}


function openSampleWindow(sample_id) {

    //$url = "http://www.freeblinds.com/t.php?addSample=" + $sample_id;
    var url, name, features;
	url = "http://www.freeblinds.com/" + sample_id;
    name = "Sample_Order_Form";

    features = "width=850,height=590,fullscreen=yes,location=no,resizable=yes,status=no,scrollbars=yes,toolbar=no";

    new_window = window.open(url, name, features);

    new_window.focus();

}



// validate ZIP and ZIP+4 codes

function validateZipCode($zip_field) {

    var $valid_chars = "0123456789-";

    var $hyphen_count = 0;



    if ($zip_field.length != 5 && $zip_field.length != 10) {

        return false;

    }

    for (var i=0; i < $zip_field.length; i++) {

        $zc = "" + $zip_field.substring(i, i+1);

        if ($zc == "-") $hyphen_count++;

        if ($valid_chars.indexOf($zc) == "-1") {

            return false;

        }

        if (($hyphen_count > 1) || (($zip_field.length==10) && ""+$zip_field.charAt(5)!="-")) {

            return false;

        }

    }

    return true;

}



// Larger Sample Window

function popupWindow(url) {

  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')

}