
function open_large_image(url) {
    var  new_url, name, features, new_window;
    new_url = "http://www.islandblinds.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 open_calc() {
    var  new_url, name, features, new_window;
    new_url = "http://www.islandblinds.com/multi-headrail-calculator.php";
    name = "Multi_headrail_calculator";
    features = "width=550,height=140,fullscreen=no,location=no,resizable=yes,status=no,scrollbars=auto,toolbar=no";
    new_window = window.open(new_url, name,features);
    new_window.focus();

}



function callAHAH(url, pageElement, callMessage, errorMessage)

{

document.getElementById(pageElement).innerHTML=callMessage;

try{ req=new XMLHttpRequest(); }

catch(e){

try { req = new ActiveXObject("Msxml2.XMLHTTP"); /* some versions IE */ }

catch (f) {

try{ req = new ActiveXObject("Microsoft.XMLHTTP");/* some versions IE */ }

catch (E){ req = false;}

}}

req.onreadystatechange = function()

{ responseAHAH(pageElement, errorMessage); }

req.open("GET",url,true); 

req.send(null); }



function responseAHAH(pageElement, errorMessage) {

if(req.readyState == 4) { if(req.status == 200) { 

output = req.responseText;

document.getElementById(pageElement).innerHTML = output; 

} else { 

document.getElementById(pageElement).innerHTML = errorMessage+"\n"+responseText; } 

} }



function makeactive(page, tag)

{

  callAHAH(page, tag, '<br/><br/><span style="color:#FF0000"><strong>Loading Color Chart. Please wait...</strong></span><br/><br/>', 'Error');

}

function openColorSamplePopup(url) {
    var  new_url, name, features, new_window;
    new_url = "http://www.islandblinds.com/popup.php?file=" + url;
    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 openColorSamplePopup2(url,op_label_id) {
    var  new_url, name, features, new_window;
    new_url = "http://www.islandblinds.com/popup.php?file=" + url + "&op=" + op_label_id;
    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.islandblinds.com/t.php?addSample=" + $sample_id;
    var url, name, features;
	url = "http://www.islandblinds.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')

}

