//
w=screen.availWidth;
h=screen.availHeight;
//
//nwarr() = new Array 
//var windowsArray=new Array();
//
//
var bToggleViewer;
//
var bIsLastObjSelect = false;
var sLastObjSelect = false;
var sLastObjSelectPic;
var sLastObjSelectColorPic;
var sLastObjSelectColorMovie;
//
//

function ToggleOrigInfo(strValue) {
    //
    //alert ("strValue  = " + strValue);
    //
    if (document.getElementById(strValue) != null) {
        if (document.getElementById(strValue).style.display == "block") {
            document.getElementById(strValue).style.display = "none";
        } else {
            document.getElementById(strValue).style.display = "block";
        }
    }
}

function toggleviewer(strValue) {
    //
    if (bToggleViewer == false) 
    {
        bToggleViewer = true;
        //
        
        //SIZE
        
        var i = 0;
        
        if (document.getElementById("tdPicV") != null) {
            i = document.getElementById("tdMovV").style.width;
            document.getElementById("tdPicV").style.width = (i - (i*(.5)));
            document.getElementById("tdPicV").style.display = "block";
        }
        
        if (document.getElementById("tdMovV") != null) {
            i = document.getElementById("tdMovV").style.width;
            document.getElementById("tdMovV").style.width = (i - (i*(.5)));
            document.getElementById("tdMovV").style.display = "block";
        }
        //
        //
        //
    } else {
        bToggleViewer = false;
        
        if (document.getElementById("tdPicV") != null) {
            document.getElementById("tdPicV").style.display = "block";
            document.getElementById("tdPicV").style.width = (i * 2);
        }
        if (document.getElementById("tdMovV") != null) {
            document.getElementById("tdMovV").style.display = "none";
            document.getElementById("tdMovV").style.width = (i * 2);
        }
    }
}

function CloseWin(myWin) {
	//
	myWin.close();
}

				
function openterms(){
	myWIN = window.open ("termsandconditions.html","Terms","height=550, width=600, top=30, left=100, channelmode=0, directories=0,fullscreen=0, location=0, menubar=0, resizable=0, scrollbars=1, status=1,titlebar=1, toolbar=0");
	myWIN.focus();
}
//
function openprivacy(){
	myWIN = window.open ("privacy.html","Privacy","height=550, width=600, top=30, left=100, channelmode=0, directories=0,fullscreen=0, location=0, menubar=0, resizable=0, scrollbars=1, status=1,titlebar=1, toolbar=0");
    myWIN.focus();
}
//
function PopSmall22(myTarget, myName, myWinName){
	window.open (myTarget, myName,"height=550, width=600, top=30, left=100, channelmode=0, directories=0,fullscreen=0, location=0, menubar=0, resizable=0, scrollbars=1, status=1,titlebar=1, toolbar=0");
}
function PopBig(myTarget, myName, myWinName){
	//w=screen.availWidth;
	//h=screen.availHeight;
	//w=w-10;
	//h=h-165;
	nw=window.open(myTarget,"","height="+h+", width="+w+", top=0, left=0, channelmode=0, directories=1,fullscreen=0, location=1, menubar=1, resizable=1, scrollbars=1, status=1,titlebar=1, toolbar=1");
	nw.focus();
	//window.open (TARGET,"Privacy","height=550, width=600, top=30, left=100, channelmode=0, directories=0,fullscreen=0, location=0, menubar=0, resizable=0, scrollbars=1, status=1,titlebar=1, toolbar=0")
	//
	//	
}

function Openpage() {
	//myWIN = window.open("http://www.claudiadonati.com/claudiadonati_app/Default.aspx","LOGIN","height="+h+", width="+w+", top=0, left=0, channelmode=0, directories=1,fullscreen=0, location=1, menubar=1, resizable=1, scrollbars=1, status=1,titlebar=1, toolbar=1");
	myWIN = window.open("../wall.aspx","site","height="+h+", width="+w+", top=0, left=0, channelmode=0, directories=1,fullscreen=0, location=1, menubar=1, resizable=1, scrollbars=1, status=1,titlebar=1, toolbar=1");
	myWIN.focus();
}

function OpenpageUpload() {
	//myWIN = window.open("http://www.claudiadonati.com/claudiadonati_app/Default.aspx","LOGIN","height="+h+", width="+w+", top=0, left=0, channelmode=0, directories=1,fullscreen=0, location=1, menubar=1, resizable=1, scrollbars=1, status=1,titlebar=1, toolbar=1");
	myWIN = window.open("../acommon/upload/fupload.aspx?entity=1&secode=1&setid=1&back=../../Apps/myfiles.aspx","_blank","height=500, width=700, top=0, left=0, channelmode=0, directories=0,fullscreen=0, location=0, menubar=0, resizable=0, scrollbars=1, status=1,titlebar=1, toolbar=0");
	myWIN.focus();
	//myWIN = nothing;
}

function OpenpageUploadFlash() {
	//myWIN = window.open("http://www.claudiadonati.com/claudiadonati_app/Default.aspx","LOGIN","height="+h+", width="+w+", top=0, left=0, channelmode=0, directories=1,fullscreen=0, location=1, menubar=1, resizable=1, scrollbars=1, status=1,titlebar=1, toolbar=1");
	myWIN = window.open("../acommon/upload/FUOthers.aspx?entity=1&secode=1&setid=1&back=../../Apps/myfiles.aspx","_blank","height=500, width=700, top=0, left=0, channelmode=0, directories=0,fullscreen=0, location=0, menubar=0, resizable=0, scrollbars=1, status=1,titlebar=1, toolbar=0");
	myWIN.focus();
	//myWIN = nothing;
}

function Openstats() {
	//myWIN = window.open("http://www.claudiadonati.com/claudiadonati_app/Default.aspx","LOGIN","height="+h+", width="+w+", top=0, left=0, channelmode=0, directories=1,fullscreen=0, location=1, menubar=1, resizable=1, scrollbars=1, status=1,titlebar=1, toolbar=1");
	myWIN = window.open("http://stats.rodimusconvoy.smashservers.com/cgi-bin/awstats.pl?config=newtapestry.org","stats","height="+h+", width="+w+", top=0, left=0, channelmode=0, directories=1,fullscreen=0, location=1, menubar=1, resizable=1, scrollbars=1, status=1,titlebar=1, toolbar=1");
	myWIN.focus();
}

function sNavigateTo(sURI) {
	window.location = sURI;
}

function sCursor(strElement,strCursorType) {
	if (document.getElementById(strElement) != null) {
	    document.getElementById(strElement).style.cursor = strCursorType;
	}
}


//function ChangePicture(strElementName,strBkgrColor,strNewDisplay,strCursorType)


function ChangePicture2(sWidth,sHeight,strType,strElementName,strValue,strValueFlash,strRadioValue,RadioName,strIndex,strValueFlashName,sHideBlock,sExtraInfo,sSelectRow,sBaseBkUG,sSelectRowBKUG,sBrowser)
{
    /*  
        this function sets the font color, backgorund color & mouse cursor for menu items 
        //"http://javascript.internet.com/img/change-image/dallas-large.jpg";
        document.getElementById(strElementName).style.cursor = strCursorType;
        
        ../clautje20app/DataImages/1.1_4-about_contact_GIF.gif
        
    */
    
    //alert ("objRadio.checked  = " + objRadio.checked);
    
    
    //alert ("strType = " + strType + " --->> strValue = " + strValue );
   
    //SET IMAGE SRC
    if (document.getElementById(strElementName) != null) {
        if (strType == "pic"){
            document.getElementById(strElementName).src = "../extras/DataImages/" + strValue;            
            ChangeText("sTextThumb","",strValue);
            ChangeText("sTextThumb","","",strValue,"");
            //
            ChangeBkgr(strIndex,"#C0C0C0",strIndex,RadioName,"Pic",sSelectRow,sBaseBkUG,sSelectRowBKUG);
            //
            
            if (document.getElementById("fFile") != null) {
                document.getElementById("fFile").innerHTML = sExtraInfo;
            }
            if (document.getElementById("tdFileViewer") != null) {
                document.getElementById("tdFileViewer").style.display = "block";
            }
            if (document.getElementById("tdMovV") != null) {
                document.getElementById("tdMovV").style.display = "none";
            }
            if (document.getElementById("tdPicV") != null) {
                document.getElementById("tdPicV").style.display = "block";
            }
            //
        }else {
            var iHeight;
            if (strType == "mov"){
                showQTPreview("extras/Data/" + strValue,strElementName,sWidth,sHeight,strValue,sBrowser); 
                ChangeText2("vcTextTitle","sTextMovieType","","Watching: " + strRadioValue,"Quick Time Movie",strValueFlashName,"sTextMoviePath");
                ChangeText2("vcExtraInfo","sTextMovieType","",sExtraInfo,"Quick Time Movie",strValueFlashName,"sTextMoviePath");
                 //
                ChangeBkgr(strIndex,"#C0C0C0",strIndex,RadioName,"Tic",sSelectRow,sBaseBkUG,sSelectRowBKUG);
                //
                iHeight = "255px";
                //
            }else {
                showFWPreview(strValue,strElementName,sWidth,sHeight,strValue);
                //alert ("strElementName = " + strElementName + " --->> strValue = " + strValue );
                ChangeText2("vcTextTitle","sTextMovieType","","Watching: " + strRadioValue,"Flash Movie",strValueFlashName,"sTextMovie");
                ChangeText2("vcExtraInfo","sTextMovieType","",sExtraInfo,"Quick Time Movie",strValueFlashName,"sTextMoviePath");
                //
                ChangeBkgr(strIndex,"#C0C0C0",strIndex,RadioName,"Tic",sSelectRow,sBaseBkUG,sSelectRowBKUG);
                //
                iHeight = "345px";
                //
                //ChangeText("sTextMovieType","Flash Movie",strValue);
                //alert ("strElementName = " + strElementName + " --->> strValue = " + strValue );
            }
            
            if (document.getElementById("fFile") != null) {
                document.getElementById("fFile").innerHTML = sExtraInfo;
            }
            if (document.getElementById("showInfo") != null) {
                document.getElementById("showInfo").style.height = iHeight;
            }
            if (document.getElementById("showInfo") != null) {
                document.getElementById("showInfo").style.height = iHeight;
            }
            strIndex += "a";
            
            if (document.getElementById(strIndex) != null) {
                document.getElementById(strIndex).style.color = "black";
            }
            /*
            if (document.getElementById("tdMovV") != null) {
                document.getElementById("tdMovV").style.display = "block";
            }
            */
        }
    }	
}

function ChangePicture(sWidth,sHeight,strType,strElementName,strValue,strValueFlash,strRadioValue,RadioName,strIndex,strValueFlashName,sHideBlock,sExtraInfo,sBrowser)
{
    /*  
        this function sets the font color, backgorund color & mouse cursor for menu items 
        //"http://javascript.internet.com/img/change-image/dallas-large.jpg";
        document.getElementById(strElementName).style.cursor = strCursorType;
        
        ../clautje20app/DataImages/1.1_4-about_contact_GIF.gif
        
    */
    
    /*
    var objRadio  = document.getElementById(RadioName)
    
    alert ("document.form1.rdImgTemp.length  = " + document.form1.rdImgTemp.length); 
    
    //alert ("objRadio.checked  = " + objRadio.checked);
    //alert ("objRadio.name  = " + objRadio.name);
    alert ("objRadio.length  = " + objRadio.length);
    
    
    
    //objRadio[2].checked = true
    
    
    //objRadio.checked = true;
    
    for(var i = 0; i < objRadio.length; i++) {
	    objRadio[i].checked = false;
	    
	    alert ("1");
	    
	    
	    if (objRadio[i].value != null ) {
	    
	        alert ("2");
	        
	        
	        if(objRadio[i].value == strRadioValue) {
		       objRadio[i].checked = true;
		       
		       alert ("3");
		       
		    }
	    }
    }
    */
//    if(objRadio.length == undefined ) {  //null
//		//radioObj.checked = (radioObj.value == newValue.toString());
//		return;
//	}else {
//    	
//	}
    
    //alert ("objRadio.checked  = " + objRadio.checked);
    
    
    //alert ("strType = " + strType + " --->> strValue = " + strValue );
   
    //SET IMAGE SRC
    if (document.getElementById(strElementName) != null) {
        if (strType == "pic"){
            document.getElementById(strElementName).src = "../extras/DataImages/" + strValue;            
            ChangeText("sTextThumb","",strValue);
            ChangeText("sTextThumb","","",strValue,"");
            //
            ChangeBkgr(strIndex,"#C0C0C0",strIndex,RadioName,"Pic","no","","#C0C0C0");
            //
            
            if (document.getElementById("fFile") != null) {
                document.getElementById("fFile").innerHTML = sExtraInfo;
            }
            if (document.getElementById("tdFileViewer") != null) {
                document.getElementById("tdFileViewer").style.display = "block";
            }
            if (document.getElementById("tdMovV") != null) {
                document.getElementById("tdMovV").style.display = "none";
            }
            if (document.getElementById("tdPicV") != null) {
                document.getElementById("tdPicV").style.display = "block";
            }
            //
        }else {
            if (strType == "mov"){
                showQTPreview("../extras/Data/" + strValue,strElementName,sWidth,sHeight,strValue,sBrowser); 
                ChangeText("sTextMovie","sTextMovieType","",strValue,"Quick Time Movie",strValueFlashName,"sTextMoviePath");
                 //
                ChangeBkgr(strIndex,"#C0C0C0",strIndex,RadioName,"Tic","no","","#C0C0C0");
                //
            }else {
                showFWPreview(strValue,strElementName,sWidth,sHeight,strValue);
                //alert ("strElementName = " + strElementName + " --->> strValue = " + strValue );
                ChangeText("sTextMoviePath","sTextMovieType","",strValueFlash,"Flash Movie",strValueFlashName,"sTextMovie");
                //
                ChangeBkgr(strIndex,"#C0C0C0",strIndex,RadioName,"Tic","no","","#C0C0C0");
                //
                //ChangeText("sTextMovieType","Flash Movie",strValue);
                //alert ("strElementName = " + strElementName + " --->> strValue = " + strValue );
            }
            
            if (document.getElementById("fFile") != null) {
                document.getElementById("fFile").innerHTML = sExtraInfo;
            }
            if (document.getElementById("tdFileViewer") != null) {
                document.getElementById("tdFileViewer").style.display = "block";
            }
            if (document.getElementById("tdPicV") != null) {
                document.getElementById("tdPicV").style.display = "none";
            }
            if (document.getElementById("tdMovV") != null) {
                document.getElementById("tdMovV").style.display = "block";
            }
        }
    }
    
    //RADIO OBJ: document.orderform.music
    
    
    ///alert ("document.getElementById(RadioName) = " + document.getElementById(RadioName).value + " --->> strValue = " + strValue );
    
    //SET RADIO BUTTONS
    //var radioLength = objRadio.length; //objRadio.length;
    
    //alert ("objRadio.length  = " + objRadio.length + " --->> strValue = " + strValue );
    
    /*
    if(objRadio.length == undefined ) {  //null
		//radioObj.checked = (radioObj.value == newValue.toString());
		return;
	}else {
	    for(var i = 0; i < objRadio.length; i++) {
		    objRadio[i].checked = false;
		    if (objRadio[i].value != null ) {
		        if(objRadio[i].value == strRadioValue.toString()) {
			       objRadio[i].checked = true;
    		    }
		    }
	    }	
	}
	*/
	
	
}

function ChangeShow(strElementName, myW, myH,strType,strValue)
{
    //alert (" --->> strValue = " + strValue + " --->> myW = " + myW + " --->> myH = " + myH + " --->> strType = " + strType );
    //
    if (strType == "mov"){
        showQTPreview("extras/Data/" + strValue,strElementName,myW,myH,strValue,sBrowser); 
    }else {
        showFWPreview(strValue,strElementName,myW,myH,strValue);
    }
}


function showQTPreview(currQT,strElementName, myW, myH,strValue)
{

    var isSelection = currQT;
    var QTObjStr = "poop";
    
    
   //alert ("currQT = " + currQT + " --->> strElementName = " + strElementName );
     
    QTObjStr = "<object width='" + myW + "' height='" + myH + "'>"  + 
        "<param name='controller' value='TRUE' />" +
        "<param name='qtsrc' value='" + isSelection + "' />" +
        "<param name='type' value='video/quicktime' />" +
        "<param name='autoplay' value='false' />" +
        "<param name='scale' value='tofit' />" +
        "<param name='movie' value='"+isSelection+"' />" +
        "<param name='pluginspage' value='http://www.apple.com/quicktime/download/indext.html' />" +
        "<embed width='" + myW  +"' height='" + myH + "' autoplay='false' scale='tofit' controller='TRUE' src='"+isSelection+"' " +
            "type='video/quicktime' border='0' pluginspage='http://www.apple.com/quicktime/download/indext.html'> </embed>" +
        "</object>";
    
      
    //salert ("QTObjStr = " + QTObjStr ); //+ " --->> strElementName = " + strElementName );
        
    document.getElementById(strElementName).innerHTML = QTObjStr;
}

function showFWPreview(currQT,strElementName, myW, myH,strValue)
{

   //alert ("currQT = " + currQT + " --->> strElementName = " + strElementName );
    
    var isSelection = currQT;
    var QTObjStr = "poop";

    QTObjStr ="<object width='" + myW + "' height='" + myH + "'>" + 
        "<param name='movie'" + " value='" + isSelection + "&autoPlay=true'>" +
        "</param><param name='allowFullScreen' value='true'></param>" +
        "<param name='autoplay' value='true'></param>" +
        "<param name='flashvars' value='videoFile='" + isSelection + "&autoPlay=true'/param>" +
        "<embed src='" + isSelection + "&autoPlay=true'" +
        " type='application/x-shockwave-flash' allowfullscreen='true' autoplay='true'" +
        "width='" + myW + "' height='" + myH + "'></embed></object>";
    
    document.getElementById(strElementName).innerHTML = QTObjStr;
    
    
}


function ChangeText(strElementName,strElementNameType,strType,strValue, strValueType,strValueFlashName,strElementMovieName)
{  
    //alert ("strElementName = " + strElementName + " --->> strValue = " + strValue );
   
    if (document.getElementById(strElementName) != null) {
    
        document.getElementById(strElementName).value = strValue;
        
    }
    if (document.getElementById(strElementMovieName) != null) {
    
        document.getElementById(strElementMovieName).value = strValueFlashName;
        
    }
    if (document.getElementById(strElementNameType) != null) {
    
        document.getElementById(strElementNameType).value = strValueType;
    }
}


function ChangeText2(strElementName,strElementNameType,strType,strValue, strValueType,strValueFlashName,strElementMovieName)
{  
    //alert ("strElementName = " + strElementName + " --->> strValue = " + strValue );
   
    if (document.getElementById(strElementName) != null) {
    
        document.getElementById(strElementName).innerHTML = strValue;
        
    }
    /*
    if (document.getElementById(strElementMovieName) != null) {
    
        document.getElementById(strElementMovieName).value = strValueFlashName;
        
    }
    if (document.getElementById(strElementNameType) != null) {
    
        document.getElementById(strElementNameType).value = strValueType;
    }
    */
}

function ChangeBkgr(strElementName,strValue,strIndex,RadioName,bPic,sSelectRow,sBaseBkUG,sSelectRowBKUG)
{  
    //+ " --->> sLastObjSelectColor = " + sLastObjSelectColor 
    //alert ("strElementName = " + strElementName + " --->> strValue = " + strValue + " --->> strIndex = " + strIndex + " --->> sSelectRow = " + sSelectRow);
    
      
        if (bPic=="Pic") {
            if (document.getElementById(sLastObjSelectPic) != null) 
            {  
                document.getElementById(sLastObjSelectPic).style.backgroundColor = sLastObjSelectColorPic;
            }
        }else
        {
            if (sSelectRow != "no" && !bIsLastObjSelect) {
                sLastObjSelect = sSelectRow;
                sLastObjSelectColorMovie = sBaseBkUG;
            }
            if (document.getElementById(sLastObjSelect) != null) 
            {  
                document.getElementById(sLastObjSelect).style.backgroundColor = sLastObjSelectColorMovie;
            }
        }
        
        //document.getElementById(sLastObjSelect).style.backgroundColor = sLastObjSelectColor;
    
    //
    if (document.getElementById(strElementName) != null) 
    {
        if (sSelectRow != "no") {  //&& !bIsLastObjSelect
            if (!bIsLastObjSelect) {
                sLastObjSelect = sSelectRow;
            }
            strValue = sSelectRowBKUG;
        }
        //
        if (bPic=="Pic") 
        {
            sLastObjSelectColorPic = document.getElementById(strElementName).style.backgroundColor;
            sLastObjSelectPic = strElementName;
            bIsLastObjSelect = true;
        }else
        {
            sLastObjSelectColorMovie = document.getElementById(strElementName).style.backgroundColor;
            sLastObjSelect = strElementName;
            bIsLastObjSelect = true;
        }
        document.getElementById(strElementName).style.backgroundColor = strValue;       //background-color = strValue;     //: #FFFFFF; = strValue;
        
        strElementName = strElementName + "a"
        if (document.getElementById(strElementName) != null) 
        {
            document.getElementById(strElementName).style.backgroundColor = strValue;
        }
        if (document.getElementById(strElementName) != null) {
            document.getElementById(strIndex).style.color = "white";
        }
    }
    //
}

function max(url,name){
	w=screen.availWidth;
	h=screen.availHeight;
	//w=w-10;
	//h=h-165;
	nw=window.open(url,name,"height="+h+", width="+w+", top=0, left=0, channelmode=0, directories=1,fullscreen=1, location=1, menubar=0, resizable=0, scrollbars=1, status=0,titlebar=0, toolbar=0");
	nw.focus();	
}
