﻿//for ~/default.aspx
$(document).ready(function () {



    //
    //start prelod images//////////////////////////////////////////////////////////////////////////////////////////////
    (function ($) {
        var imgList = [];
        $.extend({
            preload: function (imgArr, option) {
                var setting = $.extend({
                    init: function (loaded, total) { },
                    loaded: function (img, loaded, total) { },
                    loaded_all: function (loaded, total) { }
                }, option);
                var total = imgArr.length;
                var loaded = 0;

                setting.init(0, total);
                for (var i in imgArr) {
                    imgList.push($("<img />")
					.attr("src", imgArr[i])
					.load(function () {
					    loaded++;
					    setting.loaded(this, loaded, total);
					    if (loaded == total) {
					        setting.loaded_all(loaded, total);
					    }
					})
				);
                }

            }
        });
    })(jQuery);




    $.preload([
		"images/bg_raya.jpg",
        "images/bg_corp.jpg"
	], {
	    init: function (loaded, total) {
	        

	    },
	    loaded: function (img, loaded, total) {
	      //  alert("s");
	       // $('#flash_day').show();
	      //  $('.tableFooter').show();

	    },
	    loaded_all: function (loaded, total) {



	      //  $('#flash_day').show();
	      //  $('.tableFooter').show();

	    }
	});

    //	flashembed("flashdiv", "raya_day.swf");

    //$('#mainbg').fadeIn();
    //$('.tableFooter').fadeIn();

    //end preload images//////////////////////////////////////////////////////////////////////////////////////////////


    //change color for 3 main div when mouseover/mouseleave
    var mouseoverSpeed = 200;
    var mouseleaveSpeed = 90;
    var mouseoverColor = "#feec8c";
    var mouseleaveColor = "#FFFFFF";

    $('#digDesign').mouseover(function (e) {
        $('#digDesign').animate({ backgroundColor: mouseoverColor }, mouseoverSpeed);

        return false;
    });

    $('#digDesign').mouseleave(function (e) {
        $('#digDesign').animate({ backgroundColor: mouseleaveColor }, mouseleaveSpeed);
        return false;
    });

    $('#joycube').mouseover(function (e) {
        $(this).animate({ backgroundColor: mouseoverColor }, mouseoverSpeed);
        return false;
    });
    $('#joycube').mouseleave(function (e) {
        $(this).animate({ backgroundColor: mouseleaveColor }, mouseleaveSpeed);
        return false;
    });

    $('#consult').mouseover(function (e) {
        $(this).animate({ backgroundColor: mouseoverColor }, mouseoverSpeed);
        return false;
    });
    $('#consult').mouseleave(function (e) {
        $(this).animate({ backgroundColor: mouseleaveColor }, mouseleaveSpeed);
        return false;
    });



    $('#aboutUs').mouseover(function () {
        $(this).fadeTo("slow", 0.33);

    });

    $('#aboutUs').mouseleave(function () {
        $(this).fadeTo("slow", 1);
    });

    $('#portfolio').mouseover(function () {
        $(this).fadeTo("slow", 0.33);
    });

    $('#portfolio').mouseleave(function () {
        $(this).fadeTo("slow", 1);
    });

    $('#clientList').mouseover(function () {
        $(this).fadeTo("slow", 0.33);
    });

    $('#clientList').mouseleave(function () {
        $(this).fadeTo("slow", 1);
    });

    $('#contactUs').mouseover(function () {
        $(this).fadeTo("slow", 0.33);
    });

    $('#contactUs').mouseleave(function () {
        $(this).fadeTo("slow", 1);
    });


});

var clear = "unitpngfix/clear.gif"; //path to clear.gif
document.write('<script type="text/javascript" id="ct" defer="defer" src="javascript:void(0)"><\/script>'); var ct = document.getElementById("ct"); ct.onreadystatechange = function() { pngfix() }; pngfix = function() { var els = document.getElementsByTagName('*'), ip = /\.png/i, al = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='", i = els.length, uels = new Array(), c = 0; while (i-- > 0) { if (els[i].className.match(/unitPng/)) { uels[c] = els[i]; c++; } } if (uels.length == 0) pfx(els); else pfx(uels); function pfx(els) { i = els.length; while (i-- > 0) { var el = els[i], es = el.style, elc = el.currentStyle, elb = elc.backgroundImage; if (el.src && el.src.match(ip) && !es.filter) { es.height = el.height; es.width = el.width; es.filter = al + el.src + "',sizingMethod='crop')"; el.src = clear; } else { if (elb.match(ip)) { var path = elb.split('"'), rep = (elc.backgroundRepeat == 'no-repeat') ? 'crop' : 'scale', elkids = el.getElementsByTagName('*'), j = elkids.length; es.filter = al + path[1] + "',sizingMethod='" + rep + "')"; es.height = el.clientHeight + 'px'; es.backgroundImage = 'none'; if (j != 0) { if (elc.position != "absolute") es.position = 'static'; while (j-- > 0) if (!elkids[j].style.position) elkids[j].style.position = "relative"; } } } } }; };