﻿var r = jQuery.noConflict();
r(function() {


    //random image
    //326: height;
    
    
    
    
    r("a[rel=nofollow]").attr("target", "_blank");//hahaha
    

    r("div#comments form fieldset dl dt select").change(function() {
        var emotionCheck = r(this).val();
        var display = r("div#comments form fieldset dl dd span#emotion");
        switch (emotionCheck) {
            case "1":
                {
                    display.attr("class", "glad");
                    break;
                }
            case "2":
                {
                    display.attr("class", "cheerful");
                    break;
                }
            case "3":
                {
                    display.attr("class", "sick");
                    break;
                }
            case "4":
                {
                    display.attr("class", "cry");
                    break;
                }
            case "5":
                {
                    display.attr("class", "noemotion");
                    break;
                }
            case "6":
                {
                    display.attr("class", "pissed");
                    break;
                }
            case "7":
                {
                    display.attr("class", "surprised");
                    break;
                }

        }

        //<option value="1">GLAD</option>
        //<option value="2">JOYFUL</option>
        //<option value="3">DISTURBED</option>
        //<option value="4">SAD</option>
        //<option value="5">DON'T GET IT</option>
        //<option value="6">ANNOYED</option>
        //<option value="7">SURPRISED</option>


    });


//replace this



if(r("html").attr("lang")=="ja")
{
    r("a.chietets").lightBox({

        imageLoading: 'rchStyles/images/lightbox-ico-loading.gif', //rchStyle/images/lightbox-ico-loading.gif
        imageBtnClose: 'rchStyles/images/lightbox-btn-close-japanese.gif', //rchStyle/images/lightbox-btn-close-japanese.gif
        imageBtnPrev: 'rchStyles/images/lightbox-btn-prev-japanese.gif', //rchStyle/images/lightbox-btn-prev-japanese.gif
        imageBtnNext: 'rchStyles/images/lightbox-btn-next-japanese.gif'//rchStyle/images/lightbox-btn-next-japanese.gif


        
    });

r("textarea").charCounter(120, null);
}
else
{
    r("a.chietets").lightBox({

        imageLoading: 'rchStyles/images/lightbox-ico-loading.gif', //rchStyle/images/lightbox-ico-loading.gif
        imageBtnClose: 'rchStyles/images/lightbox-btn-close.gif', //rchStyle/images/lightbox-btn-close-japanese.gif
        imageBtnPrev: 'rchStyles/images/lightbox-btn-prev.gif', //rchStyle/images/lightbox-btn-prev-japanese.gif
        imageBtnNext: 'rchStyles/images/lightbox-btn-next.gif'//rchStyle/images/lightbox-btn-next-japanese.gif

        /*
        imageLoading: 'http://example.com/images/loading.gif', //rchStyle/images/lightbox-ico-loading.gif
        imageBtnClose: 'http://example.com/images/close.gif', //rchStyle/images/lightbox-btn-close-japanese.gif
        imageBtnPrev: 'http://example.com/images/prev.gif',//rchStyle/images/lightbox-btn-prev-japanese.gif
        imageBtnNext: 'http://example.com/images/next.gif'//rchStyle/images/lightbox-btn-next-japanese.gif
        //imageBlank:rchStyle/images/lightbox-blank.gif
        //    containerResizeSpeed: 350,
        //  txtImage: 'Imagem',
        // txtOf: 'de'
        */
    });
    r("textarea").charCounter(254, null);

}




    r(".hyop").css("float", "left").css("width", "100%").css("height", "200px").easySlider({
        auto: true,
        prevText: 'Previous',
        nextText: 'Next',
        firstShow: true,
        lastShow: true,
        continuous: true
    });




    r(".rchShuffle li").css("height", "50px");


    function initializerchShuffle() {
        r('.rchShuffle').kwicks({
            max: 350,
            spacing: 0,
            isVertical: true
        });


    }




    //   r.easing.def = "easeOutBounce";

    //r.easing.def = "easeOutBounce";
    //r.easing.def = "easeInOutBounce";
    //r.easing.def = "easeInExpo";
    var oldEase = r.easing.def;

    r.easing.def = "easeOutBack";
    r("#logo,#feedButtonRSS,#feedButtonATOM").text("");
    
    
    


    r("#addFavo").click(function(ayn) {

        ayn.preventDefault();
        // window.external.AddFavorite(location.href, document.title);

        //window.external.AddFavorite("http://clcdiscountshop.com", "CLCWEB")


        if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
            window.external.AddFavorite(location.href, document.title);
        } else if (navigator.appName == "Netscape") {
            window.sidebar.addPanel(document.title, location.href, "");
        } else {
            alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
        }









    });






    //bgease






    

    r("link[href='rchStyles/ashigakari.css']").mouseover(function() {


        r("#ashigakari #stepstones span").stop();
        r("#graystep").css({ backgroundPosition: "0px -1100px" })
	.animate(
			{ backgroundPosition: "(0px -1088px)" },
			{ duration: 500 });

        r("#yellowstep").css({ backgroundPosition: "-40px -1150px" })
	.animate(
			{ backgroundPosition: "(-40px -1118px)" },
			{ duration: 600 });

        r("#bluestep").css({ backgroundPosition: "-80px -1200px" })
	.animate(
			{ backgroundPosition: "(-80px -1152px)" },
			{ duration: 700 });


        r("#lightbluestep").css({ backgroundPosition: "-120px -1250px" })
	.animate(
			{ backgroundPosition: "(-120px -1182px)" },
			{ duration: 800 });


        r("#violetstep").css({ backgroundPosition: "-160px -1300px" })
	.animate(
			{ backgroundPosition: "(-160px -1217px)" },
			{ duration: 900 });



        r("#orangestep").css({ backgroundPosition: "-200px -1350px" })
	.animate(
			{ backgroundPosition: "(-200px -1247px)" },
			{ duration: 1000 });

        r("#redstep").css({ backgroundPosition: "-237px -1400px" })
	.animate(
			{ backgroundPosition: "(-237px -1277px)" },
			{ duration: 1100 });



    })


	.mouseout(function() {

	    r("#ashigakari #stepstones span").stop();

	    r("#redstep").css({ backgroundPosition: "-237px -1200px" })
	.animate(
			{ backgroundPosition: "(-237px -1277px)" },
			{ duration: 500 });
	    r("#orangestep").css({ backgroundPosition: "-200px -1150px" })
	.animate(
			{ backgroundPosition: "(-200px -1247px)" },
			{ duration: 600 });
	    r("#violetstep").css({ backgroundPosition: "-160px -1100px" })
	.animate(
			{ backgroundPosition: "(-160px -1217px)" },
			{ duration: 700 });

	    r("#lightbluestep").css({ backgroundPosition: "-120px -1050px" })
	.animate(
			{ backgroundPosition: "(-120px -1182px)" },
			{ duration: 800 });
	    r("#bluestep").css({ backgroundPosition: "-80px -1000px" })
	.animate(
			{ backgroundPosition: "(-80px -1152px)" },
			{ duration: 900 });
	    r("#yellowstep").css({ backgroundPosition: "-40px -950px" })
	.animate(
			{ backgroundPosition: "(-40px -1118px)" },
			{ duration: 1000 });

	    r("#graystep").css({ backgroundPosition: "0px -900px" })
	.animate(
			{ backgroundPosition: "(0px -1088px)" },
			{ duration: 1100 });


















	});





    function rchAyanaEf() {

        // r("#logo").mouseover();
        r("link[href='rchStyles/ashigakari.css']").mouseover();
    }

    function rchAyanaEf2() {

        //  r("#logo").mouseout();
        r("link[href='rchStyles/ashigakari.css']").mouseout();



    }
    
    
    

    setTimeout(rchAyanaEf, 1000);

    setTimeout(rchAyanaEf2, 3000);
   setTimeout(initializerchShuffle, 6000);


  
   

    //appendingForEmpty
    r("div#comments form fieldset .retry").after("<span class='emptyChecker'></span>");

    r("#search,div#comments form fieldset input[type=text],div#comments form fieldset textarea").focus(function() {

        var chieColor = r("#contain").attr("class");
        var aynColor = "";
        switch (chieColor) {
            case "red":
                {
                    aynColor = "#762004";
                    break;
                }
            case "orange":
                {
                    aynColor = "#dc4a15";
                    break;
                }
            case "gray":
                {
                    aynColor = "#CCC";
                    break;
                }
            case "blue":
                {
                    aynColor = "#5b9ded";
                    break;
                }
            case "lightblue":
                {
                    aynColor = "#8ea2e7";
                    break;
                }
            case "violet2":
                {
                    aynColor = "#ad9de6";
                    break;
                }
            case "violet1":
                {
                    aynColor = "#a395d8";
                    break;
                }
            case "yellow":
                {
                    aynColor = "#ffde7e";
                    break;
                }


        }






        r(this).effect("highlight", { color: aynColor }, 3000);

    });

    //According to the W3C standard, the <link> tag supports event attributes.
    // However, since the link element is located in the head section, 
    //we cannot see any use for this.
    
    //
    //but not me, heheheh
    //http://www.w3schools.com/TAGS/tag_link.asp

    //   r.easing.def = "easeOutBounce";
    //default
    //  swing

//seo calling
    
    r("span.ayana,span.arai").attr("title","");


    r('.postImage dt span').mouseover(function() {

        r.easing.def = oldEase;

        r(this).stop().animate(


			{ backgroundPosition: "(0px 0px)" },
			{ duration: 500 })
			.animate(
			{ backgroundPosition: "(-100px 0px)" },
			{ duration: 500 })
					.animate(
			{ backgroundPosition: "(-100px -10px)" },
			{ duration: 500 })
			.animate(
			{ backgroundPosition: "(0px -10px)" },
			{ duration: 500 })
			.animate(
			{ backgroundPosition: "(0px 0px)" },
			{ duration: 500 })
    })
	.mouseout(function() {



	    r(this).stop()
			.animate(
			{ backgroundPosition: "(0px 0px)" },
			{ duration: 500 })
			.animate(
			{ backgroundPosition: "(0px -10px)" },
			{ duration: 500 })
					.animate(
			{ backgroundPosition: "(-100px -10px)" },
			{ duration: 500 })
	.animate(
			{ backgroundPosition: "(-100px 0px)" },
			{ duration: 500 })

	    .animate(
			{ backgroundPosition: "(0px 0px)" },
			{ duration: 500 })



	});


//capcha ajax

var _LANGUAGE = r("html").attr("lang");
var _IMAGELABEL = "GET NEW IMAGE";
var _IMAGEEXPLANATION = "CLICK HERE TO GET NEW IMAGE";

switch(_LANGUAGE)
{
case "ja":{
_IMAGELABEL = "新しいイメージをロードする";
_IMAGEEXPLANATION = "新しいイメージをロードするように、押してください";

break;
}

default:{
break;
}

}


r("img[alt='captcha']").after("<br class='captchaBreak' /><a href='/' id='rchImgLoader' style='font-size:10px;' title='"+_IMAGEEXPLANATION+"'>"+_IMAGELABEL+"</a>")



var _GETCOUNTER = 0;

r("#rchImgLoader").attr("href",r("img[alt='captcha']").attr("src")).click(function(ayana){
ayana.preventDefault();
_GETCOUNTER++;


if(_GETCOUNTER<2){
var _saveCapcha = r("img[alt='captcha']").attr("src");
r("img[alt='captcha']").remove();
r(".captchaBreak").remove();
var _IMG_ADD = "<img alt='captcha' src='"+_saveCapcha+"' />";
_IMG_ADD += "<br class='captchaBreak' />";

r(this).before().before(_IMG_ADD);

}
else{

var _redirect= r("link[rel=canonical]").attr("href");

location = _redirect;
//location = window.top.location.href;
}


//alert(window.top.location);
});

//fix of Yahoo Buzz!





r(".yahooBuzzBadge a").attr("rel","no follow").attr("target","_blank");

r(".yahooBuzzBadge").append("<span class=\"sharetext chieManipulate\" >Yahoo! Buzz</span>");
r(".chieManipulate").css("cursor","pointer").css("margin-left","20px").click(function(){

r(".yahooBuzzBadge a").click();
});





 
 

});
    
