////////////////////////////////////////////////////////////////////////////////
// Envision v2.0 by Inscripts                                                 //
////////////////////////////////////////////////////////////////////////////////
// Written by Anant Garg, webmaster@inscripts.com                             //
// Available from http://www.inscripts.com <> http://www.envisionv2.com       //
////////////////////////////////////////////////////////////////////////////////
// This script is provided "as is" with no kind of warranty.                  //
// If you encounter errors while using this script , feel free to contact     //
// us at support@envisionv2.com                                               //
////////////////////////////////////////////////////////////////////////////////
// By using this script you agree to indemnify Anant Garg from any liability  //
// that might arise from it's use. Inscripts.com and its staff does not       //
// guarantee that the script will work on all servers and will not be         //
// held liable for anything.                                                  //
//                                                                            //
// Selling the code for this program without prior written consent is         //
// expressly forbidden. Obtain permission before redistributing this script   //
// via any medium.                                                            //
//                                                                            //
// Use At Your Own Risk !!!                                                   //
////////////////////////////////////////////////////////////////////////////////

///////// DO NOT EDIT ANYTHING BELOW UNLESS YOU KNOW WHAT YOU'RE DOING /////////

var myfindex; 
var myfs = new Array();

function formatmyf(string,text) {
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return;
    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return;
    if (i == -1) {
        myfs[myfindex++] = string;
        return;
    }
    myfs[myfindex++] = string.substring(0,i);
    if (i+txtLength < strLength)
        formatmyf(string.substring(i+txtLength,strLength),text);
    return;
}


function myfolder(filename, name) {

var files = getcookie("myFolder");

if (document.images[name].alt == "Add to myFolder") {
document.images[name].src = removeurl;
document.images[name].alt = "Remove from myFolder";
statusbar('Remove from myFolder');
if (files != "1") {
myf_cookie = files+"|"+filename;
} else {
myf_cookie = filename;
}
} else {
myfindex = 0;
var myf_cookie = "";
formatmyf(files,'|');
for (var i=0; i < myfindex; i++) {
if (myfs[i] != filename) {
if (myf_cookie != "") {
myf_cookie = myf_cookie + "|" + myfs[i];
} else {
myf_cookie = myfs[i];
}
}
}

if (myfolderview == 0) {
document.images[name].src = addurl;
document.images[name].alt = "Add to myFolder";
statusbar('Add To myFolder');
}
}

var expiry = new Date(today.getTime() +  1000 * 60 * 60 * 24 * 100 * 365);
document.cookie="myFolder" + "=" + myf_cookie + "; expires=" + expiry.toGMTString();

if (myfolderview == 1) {
window.location.reload();
} else if (myfolderview == 2) {
window.location.href = newlocation;	
}
}

function checkstatus(name) {
if (document.images[name].alt == "Add to myFolder") {
self.status = "Add to myFolder";
} else {
self.status = "Remove from myFolder";
}
} 

function statusbar(msgStr) { 
self.status = msgStr; 
} 