﻿function PopUpShowing(sender, eventArgs) {
    var popUp;
    popUp = eventArgs.get_popUp();
    var gridWidth = sender.get_element().offsetWidth;
    var gridHeight = sender.get_element().offsetHeight;
    var popUpWidth = popUp.style.width.substr(0, popUp.style.width.indexOf("px"));
    popUp.style.left = ((gridWidth - popUpWidth) / 2 + 150).toString() + "px";
}

function thetext(type) {
    if (type == 'big') {

        document.getElementById("bigchar").innerHTML = '<a style="background-position:0 -21px;" onclick=thetext("big") href=#>A</a>';
        document.getElementById("smallchar").innerHTML = '<a style="background-position:0 0" onclick=thetext("small") href=#>A</a>';
        var sl = document.getElementById("text");
        sl.className = "dimension16";
    }
    else if (type == 'small') {

        document.getElementById("bigchar").innerHTML = '<a style="background-position:0 0" onclick=thetext("big") href=#>A</a>';
        document.getElementById("smallchar").innerHTML = '<a style="background-position:0 -18px" onclick=thetext("small") href=#>A</a>';
        var sl = document.getElementById("text");
        sl.className = "dimension12";
    }
}


function showDiv() {
    document.getElementById("ctl00_CPH_Site_div_register").style.display = "inline";

    document.getElementById("ctl00_CPH_Site_div_login").style.display = "none";
}

function faq_view(id) {

    var e = document.getElementById("ans" + id);
    var f = document.getElementById("que" + id);

    if ($(f).className == 'question_on') {


        Effect.BlindUp(e, { duration: 0.3, afterFinish: function() {

            $(f).className = 'question_off';
        }
        });

    }
    else {
        $(f).className = 'question_on';

        Effect.BlindDown(e, { duration: 0.3 });

    }

}
function block_view(id) {

    var f = document.getElementById("blocco" + id);

    if ($(f).className == 'show') {
        $(f).className = 'hidden';
    }
    else {
        $(f).className = 'show';
    }
}

function delDefaultValue(elem) {

    elemChange = document.getElementById(elem);
    if (elemChange == null) {
        elemChange = document.getElementById("ctl00_prdSearch");
    }
    if (elemChange.value == elemChange.defaultValue) {
        elemChange.value = '';
    }
    elemChange.style.color = '#333';
}

function checkEmptyValue(elem) {
    elemChange = document.getElementById(elem);
    if (elemChange == null) {
        elemChange = document.getElementById("ctl00_prdSearch");
    }
    if (elemChange.value == '') {
        elemChange.style.color = '#999';
        elemChange.value = elemChange.defaultValue;

    }
}
function openInvoice() {
    if (document.getElementById("invoice").style.display == "none") {
        document.getElementById("invoice").style.display = "block";
    } else {
        document.getElementById("invoice").style.display = "none";
    }
}

function cot_view(id, num) {
    var f = document.getElementById("bloccocot" + id);
    if ($(f).className == 'show') {
        $(f).className = 'hidden';
        document.getElementById("cot_step1_" + id).style.display = "none";
        document.getElementById("cot_step2_" + id).style.display = "none";
        document.getElementById("cot_step3_" + id).style.display = "none";
        document.getElementById("cot_step4_" + id).style.display = "none";
        if (num = 4) {
            document.getElementById("cot_step5_" + id).style.display = "none";
        }
        document.getElementById("cot_id_" + id).style.display = "none";



    }
    else {
        $(f).className = 'show';
        if (num == 3) {

            Effect.BlindDown('cot_step1_' + id, {
                afterFinish: function() {
                    Effect.BlindDown('cot_step2_' + id, {
                        afterFinish: function() {
                            Effect.BlindDown('cot_step3_' + id, {
                                afterFinish: function() {
                                    Effect.BlindDown('cot_step4_' + id, {

                                        afterFinish: function() {
                                            Effect.Appear('cot_id_' + id)
                                        } 
                                    }


                                                                                                                                                                                                             )
                                }
                            })
                        }
                    }

                                                                                                                                              )
                }
            });



        } else {

            Effect.BlindDown('cot_step1_' + id, {
                afterFinish: function() {
                    Effect.BlindDown('cot_step2_' + id, {
                        afterFinish: function() {
                            Effect.BlindDown('cot_step3_' + id, {
                                afterFinish: function() {
                                    Effect.BlindDown('cot_step4_' + id, {
                                        afterFinish: function() {
                                            Effect.BlindDown('cot_step5_' + id, {
                                                afterFinish: function() {
                                                    Effect.Appear('cot_id_' + id)
                                                } 
                                            }
                                                                                                                                                                                              )
                                        }
                                    }

                                                                                                                                                                                                             )
                                }
                            })
                        }
                    }

                                                                                                                                              )
                }
            });




        }
    }
} 

