views:

60

answers:

1

IE 8 block my custom scripts every time i run my web site,and i need to click "allow scripts" to run it correctly.Its boring.

Any ideas?

The script:

// JavaScript Document
var char=0;
var caption = "";
var standby;

var msg = "Lorem ipsum dolor sit amet, consenctuinv isdrulix core";


var selectedItem = 1;
var lastItem;
    var fotos = new Array();
    fotos[0] = "Img/Dela/wan_crowd2.jpg" 
    fotos[1] = "Img/Dela/wan_dog.jpg";
    fotos[2] = "Img/Dela/wan_spirit.jpg" 
    fotos[3] = "Img/Dela/wan_pose_bra.jpg";
    fotos[4] = "Img/Dela/wan_crowd2.jpg" 
    var interval;
$(function(){
           //Main rotator ----------------------------------------------------------------------------------------
            if($("#mainPhoto").html() == ""){
                $("#mainPhoto").html($("<img></img>").attr({src:fotos[1]}));
                $(".control:first").css({color:"#fff",background:"none"});
                selectedItem = 2;
                lastItem = 1;
                ShowCaption(null);
            }
           interval = setInterval("AutoRotate()",5000);
           $(".control,#mainPhoto").hover(function(){
                                      clearInterval(interval);
                                      },function(){
                                         interval = setInterval("AutoRotate()",5000);                                   
                                          });
           $(".control").click(function(){
                                        var idFoto = $(this).text();
                                        $("#runnerDiv").css("background","url(" + fotos[(selectedItem - 1)] + ") no-repeat top left");
                                        $("#mainPhoto").html($("<img></img>").attr({src:fotos[parseInt(idFoto)]}).css({width:"407px",height:"289px",display:"none"}).fadeIn(1500));

                                        $(this).parent().nextAll().find("a").css({color:"#e4065d",backgroundColor:"#fff"});
                                        $(this).parent().prevAll().find("a").css({color:"#e4065d",backgroundColor:"#fff"});

                                        $(this).css({color:"#fff",background:"none"});

                                        lastItem = idFoto;
                                        if((parseInt(idFoto) + 1) <= 4)
                                        selectedItem = (parseInt(idFoto) + 1);
                                        else
                                        selectedItem = 1;
                                            ShowCaption(null);

                                        });
           //end main rotator --------------------------------------------------------------------------------
           $("#perfilWrapper ul li").hover(function(){
                                                        $(this).css("z-index","10");
                                                            $(this).find("img").css("background","#c9c").stop().animate({
                                                                                                                        width:"113px",
                                                                                                                        height:"85px",
                                                                                                                        left:'-20px',
                                                                                                                        top:'-50px'
                                                                                                                        },200);
                                                        },function(){
                                                            $(this).css("z-index","0");
                                                                        $(this).find("img").css("background","#f0f0f0").stop().animate({
                                                                                                                        width:"54px",
                                                                                                                        height:"40px",                                                                                                                                                                                                                                                  left:'0',
                                                                                                                        top:'0'
                                                                                                                        },500);                                             
                                                            });

           });
function AutoRotate(){
    var controles = $(".control");
    $("#runnerDiv").css("background","url(" + fotos[(selectedItem - 1)] + ") no-repeat top left");
    $("#mainPhoto").html($("<img></img>").attr({src:fotos[selectedItem]}).css({display:"none"}).fadeIn(1500));
    var colorName = "";
    var numColor = parseInt(lastItem);
    switch(numColor)
    {
        case 1:
        colorName = "#0c3";
        break;
        case 2:
        colorName = "#3AABE7";
        break;
        case 3:
        colorName = "#EAC900";
        break;
        case 4:
        colorName = "#A203FD";
        break;
    }
    controles.filter(function(){return $(this).text() == selectedItem.toString();}).css({color:"#fff",background:"none"});

            $("#mainPhoto").attr("href","home.aspx?id=" + selectedItem);//link das imagens
    if(lastItem != null)
    {
        controles.filter(function(){return $(this).text() == lastItem.toString();}).css({color:colorName,background:"#fff"});
    }
    lastItem = selectedItem;
    if(selectedItem <= 3){
    selectedItem++;
    }
    else
    selectedItem = 1;

    ShowCaption(null);
    }
function ShowCaption(obj){
    caption = msg;
    if(caption){
        type();
    }
}

function type(){
    $("#textControl").html(caption.substring(0,char++));        
    if(char < caption.length + 1){
        setTimeout("type()",10);
    }
    else
    {
        char = 0;
        caption ="";
    }
}