﻿
//Function to clear edit boxes when clicked.
function ClearInput(ThisInput) {
    document.getElementById(ThisInput).value = '';
}


function mouseOver(_Image) {
    alert('Image: ' + _Image.toString())
    //document.getElementById("mainImag").src = "/assets/Images/Thumbnails/" + _Image.toString()
}
function mouseOut(_Image) {
    alert('Image: ' + _Image.toString())
    //document.getElementById("mainImag").src = "/assets/Images/Thumbnails/" + _Image.toString()
}


function SetMainImage(_Image, width, height) {
    document.getElementById("ctl00_ContentPlaceHolder1_mainImag").src = "/Assets/Images/Standard/" + _Image.toString()
    document.getElementById("ctl00_ContentPlaceHolder1_Img_Enlarge").href = "/Assets/Images/Details/" + _Image.toString()
    document.getElementById("ctl00_ContentPlaceHolder1_mainImag").width = width;
    document.getElementById("ctl00_ContentPlaceHolder1_mainImag").height = height;
}


function ShowWatermark(WatermarkText, input) {
    if (input.value == "") {
        input.value = WatermarkText;
    }
};
function HideWatermark(WatermarkText, input) {

    if (input.value == WatermarkText) {
        input.value = "";
    }
};

function HideWatermark_DevEx(obj) {
    if (obj.GetValue() == '0' || obj.GetValue() == null) {
        //alert('HIDE')
        obj.GetInputElement().style.color = 'gray'
        obj.GetInputElement().value = '';
    }
    //else {
    //    alert('DONT HIDE')
    //}
}
    
function ShowWatermark_DevEx(obj) {
    if (obj.GetValue() == '0' || obj.GetValue() == null) {
        //alert('EMPTY LOST')
        obj.GetInputElement().style.color = 'gray'
        obj.GetInputElement().value = '0';
    }
    else {
        //alert('FULL LOST')
        obj.GetInputElement().style.color = 'black'
    }
}
         
            
        
    //obj.GetInputElement().value = text;        
    //if (obj.focused || obj.GetValue() != null)
    //    text = "777";
    //else
    //    text = "555";


function EnlargeMainImage() {

    var Standard_SRC = document.getElementById("mainImag").src;
    
    //alert('Enlarge IMG: ' + Standard_SRC)
    //alert('Enlarge IMG Replace: ' + Standard_SRC.replace('Details', 'Standard'))
    
    location = Standard_SRC.replace('Standard', 'Details');
}

function showGroupImage(showGroupImage) {
    //alert('Group Image:- ' + showGroupImage);
    if (showGroupImage == 'NoImage') {
        document.getElementById("ctl00_ContentPlaceHolder1_mainImag").src = "/Images/NoImage_Small.jpg"
        document.getElementById("ctl00_ContentPlaceHolder1_Img_Enlarge").href = "/Images/NoImage_Small.jpg"
    }
    else {
        document.getElementById("ctl00_ContentPlaceHolder1_mainImag").src = "/Assets/Images/Standard/" + showGroupImage.toString()
        document.getElementById("ctl00_ContentPlaceHolder1_Img_Enlarge").href = "/Assets/Images/Details/" + showGroupImage.toString()
    }
        
}
//function mouseOutG() {
//    document.getElementById("mainImag").src = "/Images/Structure/Shop/Product1.jpg"
//}
function EnumProperties(object) {
    var Div = document.createElement("DIV");
    Div.style.width = 300;
    Div.style.height = '100%';
    Div.style.position = "fixed";
    Div.style.backgroundColor = "FFF";
    Div.style.left = 0;
    Div.style.top = 0;
    Div.style.paddingLeft = '3px';
    Div.id = "EnumPropertiesDiv"
    Div.style.zIndex = 999999999999;
    Div.style.overflowY = "auto";
    Div.innerHTML = '<div style="width: 303px; top: 0px; left: 0px;position: fixed; background-color: #000; color: #FFF; text-align: center" onclick="document.body.removeChild(document.getElementById(' + "'EnumPropertiesDiv'" + '))">[Close]</div><br/>';
    var properties = [];
    var j = 0;
    if (object) {
        for (var i in object) {
            properties[j] = i;
            j++;
        }
    }
    if (properties.length > 0) {
        properties.sort();
        var j = 0;
        for (var i in properties) {
            Div.innerHTML += properties[j] + "<br />";
            j++;
        }
    } else {
        Div.innerHTML += "<br>NONE</br>"
    }
    document.body.appendChild(Div);
}


//----- Basic Scroller -----
var first, last, Place1, Place4
Place1 = 1;
first = 1;
function nextImage() {
    if (last > Place4) {
        document.getElementById("prevArrow").src = '/Images/Structure/arrows_left.png';
        document.getElementById('Pic' + Place1).style.display = 'none';
        Place1 = Place1 + 1
        Place4 = Place1 + 3
        document.getElementById('Pic' + Place4).style.display = 'inline';
        if (Place4 == last) {
            document.getElementById("nextArrow").src = '/Images/Structure/arrows_right.png';
        }
    }
};
function prevImage() {
    if (first != Place1) {
        document.getElementById("nextArrow").src = '/Images/Structure/arrows_right.png';
        Place1 = Place1 - 1
        document.getElementById('Pic' + Place1).style.display = 'inline';
        document.getElementById('Pic' + Place4).style.display = 'none';
        Place4 = Place4 - 1
        if (Place1 == first) {
            document.getElementById("prevArrow").src = '/Images/Structure/arrows_left.png';
        }
    }
};
function selectImage(src) {
    document.getElementById('ctl00_ContentPlaceHolder1_GalleryDisplay').innerHTML = '<a href="/assets/Images/Details/' + src + '" rel="lightbox[TicketItem]"> <img style="height: 254px;border: #ffffff 1px solid;" src="/assets/Images/Details/' + src + '"/></a>'
};
//----- ----- ----- ----- ----- -----


function ClearChars(src) {
    alert('Im Here');

    if (!isNaN(parseFloat(document.getElementById(src).value))) {
        alert('FAILED');
        document.getElementById(src).value = parseFloat(src).toFixed(2)
    }
    alert('src: ' + src);
};


