﻿var matt = null; // object
var box = null;
var username = null;
var pword = null;
var logbtn = null;
var signup = null;
var stop_scroll = false;

function setBannerHTML(html)
{
    document.getElementById('banner').innerHTML = html;
}

function scrolltop()
{
    if(stop_scroll ==true){
        scroll(0,0) ;
    }
}

function signup_x(state)
{
    if(state == 'on')
    {
        document.getElementById('signup_overlay_topexit').style.backgroundImage = "url(./images/overlay_exit_over.jpg)";
    }
    else if(state == 'off')
    {
        document.getElementById('signup_overlay_topexit').style.backgroundImage = "url(./images/overlay_exit.jpg)";
    }
}

function advsrch_x(state)
{
    if(state == 'on')
    {
        document.getElementById('search_overlay_topexit').style.backgroundImage = "url(./images/overlay_exit_over.jpg)";
    }
    else if(state == 'off')
    {
        document.getElementById('search_overlay_topexit').style.backgroundImage = "url(./images/overlay_exit.jpg)";
    }
}

function showCalc()
{
    document.getElementById('calc_hide').style.display = "inline";
}

function videoAction(status, name)
{
    wrapname = "wrap_div_" + name;
    linkname = "is_free_" + name;
    
    if(status == 'on')
    {
       document.getElementById(wrapname).style.backgroundImage = "url(./images/video_thumb_bg.jpg)";
       document.getElementById(wrapname).style.color = "#22a6f7";
       document.getElementById(linkname).className = "is_free_video_selected";
    }
    else if(status == 'off')
    {
       document.getElementById(wrapname).style.backgroundImage = "none";
       document.getElementById(wrapname).style.color = "#1e1e1e";
       document.getElementById(linkname).className = "is_free_video_default";
    }
}

function clearTxtBox(obj, item)
{
   switch(item)
   {
        case '1':
        obj.className = "search_textbox_type";
        break;
        case '2':
        obj.className = "login_textbox_type";
        break;
        case '3':
        document.getElementById('tempPasswordTxtBox').style.display = "none";
        document.getElementById('hidden_textbox').style.display = "inline";
        document.getElementById('ctl00$viewPasswordTxtBox').focus();
        //document.form1.viewPasswordTxtBox.focus();
        //document.forms('viewPasswordTxtBox').focus();
        // window.document.forms["form1"].viewPasswordTxtBox.focus()
        //document.getElementById('<%= viewPasswordTxtBox.ClientID %>').focus();
        break;
        case '4':
        document.getElementById('tempPasswordTxtBox2').style.display = "none";
        document.getElementById('hidden_textbox2').style.display = "inline";
        document.getElementById('ctl00$viewPasswordTxtBox2').focus();
        break;
        case '5':
        obj.className = "login_textbox_type2";
        break;
        case '6':
        obj.className = "explain_txtbox_type";
        break;
        case '7':
        obj.className = "generic_txtbox";
        break;
   }
   obj.value="";
}

function clearSearchBox(obj)
{
   obj.value="";
}

function logoHover(status, name)
{
    if(status == 'on')
    {
        switch(name)
        {
            case "pg":
            document.getElementById('pg_logo').style.backgroundImage = "url(./images/header/header_pg_small_over.jpg)";
            break;
            case "ss":
            document.getElementById('ss_logo').style.backgroundImage = "url(./images/header/header_ss_small_over.jpg)";
            break;
            case "signup_overlay_button":
            document.getElementById(name).style.backgroundImage = "url(./images/big_subscribe_button_on.jpg)";
            break;
        }
    }
    else if(status == 'off')
    {
        switch(name)
        {
            case "pg":
            document.getElementById('pg_logo').style.backgroundImage = "url(./images/header/header_pg_small.jpg)";
            break;
            case "ss":
            document.getElementById('ss_logo').style.backgroundImage = "url(./images/header/header_ss_small.jpg)";
            break;
            case "signup_overlay_button":
            document.getElementById(name).style.backgroundImage = "url(./images/big_subscribe_button_off.jpg)";
            break;
        }
    }
}

function menuHover(status, name)
{
    if(status == 'on')
    {
       document.getElementById(name).style.color = "#1e1e1e"; 
    }
    else if(status == 'off')
    {
       document.getElementById(name).style.color = "#FFFFFF";
    }
}

function adminHover(status, name)
{
    if(status == 'on')
    {
       document.getElementById(name).style.color = "#22a6f7"; 
    }
    else if(status == 'off')
    {
       document.getElementById(name).style.color = "#FFFFFF";
    }
}

function overlayHover(status, name)
{
    if(status == 'on')
    {
       document.getElementById(name).style.color = "#22a6f7"; 
    }
    else if(status == 'off')
    {
       document.getElementById(name).style.color = "#000000";
    }
}

function moreHover(status, name)
{
    if(status == 'on')
    {
       document.getElementById(name).style.color = "#1e1e1e"; 
    }
    else if(status == 'off')
    {
       document.getElementById(name).style.color = "#22a6f7";
    }
}

function initLogin()
{
    document.getElementById('item_right').style.display = "none";
    box = document.getElementById('login_wrap');
    mainlogin = document.getElementById('main_login_wrap');

    
    box.style.display = "inline"; 
    mainlogin.style.display = "inline";

    
    /*username.style.opacity = "0.0";
    username.style.MozOpacity = "0.0";  
    username.style.filter  = "alpha(opacity='0')";
    pword.style.opacity = "0.0";
    pword.style.MozOpacity = "0.0";  
    pword.style.filter  = "alpha(opacity='0')";
    logbtn.style.opacity = "0.0";
    logbtn.style.MozOpacity = "0.0";  
    logbtn.style.filter  = "alpha(opacity='0')";*/
    
    //animateLogin();

}



function animateLogin()
{
    var curWidth = parseInt(box.style.width);
    
    if(curWidth >= 992)
    {
         fadeLogin();
    }
    else
    {
        box.style.width = parseInt(box.style.width)+18+'px';
        setTimeout(animateLogin,5);
    }  
}

function fadeLogin()
{
    username.style.display = "inline";
    pword.style.display = "inline";
    logbtn.style.display = "inline";
    
    var curOpacity = parseFloat(username.style.opacity) * 100;
    //alert('curOpacity = ' + parseFloat(username.style.opacity));
    //alert('times 100 = ' + curOpacity);
    
    if(curOpacity >= 100)
    {
    
    }
    else
    {
        curOpacity += 10;
        
        username.style.opacity = curOpacity / 100;
        username.style.MozOpacity = curOpacity / 100;  
        username.style.filter  = "alpha(opacity=" + curOpacity + ")";
        pword.style.opacity = curOpacity / 100;
        pword.style.MozOpacity = curOpacity / 100;  
        pword.style.filter  = "alpha(opacity=" + curOpacity + ")";
        logbtn.style.opacity = curOpacity / 100;
        logbtn.style.MozOpacity = curOpacity / 100;  
        logbtn.style.filter  = "alpha(opacity=" + curOpacity + ")";

        setTimeout(fadeLogin,10);
    }    
}

function initBox(page)
{ 
    if(page == 'signup')
    {
       mattPage = document.getElementById('signup_overlay_wrap'); 
    }
    else if(page == 'search')
    {
       mattPage = document.getElementById('search_overlay_wrap'); 
    }
    else if(page == 'premium')
    {
       mattPage = document.getElementById('premium_overlay_wrap');
    }
    
    mattPage.style.display = "block";
    document.getElementById('1294704470414').style.display = 'block';
    moveBox = document.getElementById('movebox');
    var width = getClientWidth();
    var newwidth = (width - 610) / 2;
    moveBox.style.left = newwidth + "px";
    moveBox.style.display = "block";
}

function getClientWidth() {
  return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;
}

function closeOverlayWindow()
{
    document.getElementById('1294704470414').style.display = 'none';
    document.getElementById('movebox').style.display = 'none';
}

function animateBox()
{
    var curHeight = parseInt(matt.style.height);
    if(curHeight >= 475)
    {
         fadeBox();
    }
    else
    {
    matt.style.height = parseInt(matt.style.height)+20+'px';
    setTimeout(animateBox,5);
    }
}

function fadeBox()
{
    mattPage.style.display = "inline";
    
    var curOpacity = parseFloat(mattPage.style.opacity) * 100;
    
    if(curOpacity >= 100)
    {
    
    }
    else
    {
        curOpacity += 10;
        
        mattPage.style.opacity = curOpacity / 100;
        mattPage.style.MozOpacity = curOpacity / 100;  
        mattPage.style.filter  = "alpha(opacity=" + curOpacity + ")";

        setTimeout(fadeBox,10);
    } 
}

function closeOverlay(page)
{
    switch(page)
    {
        case "sign_up":
        document.getElementById('mattOverlay').style.display = "none";
        document.getElementById('mattBox').style.display = "none";
        document.getElementById('signup_overlay_wrap').style.display = "none";
        stop_scroll = false;
        break;
        case "search":
        document.getElementById('mattOverlay').style.display = "none";
        document.getElementById('mattBox').style.display = "none";
        document.getElementById('search_overlay_wrap').style.display = "none";
        stop_scroll = false;
        break;
    }
}

function enableScroll()
{
    stop_scroll = false;
}

function hideSignup()
{
    document.getElementById('item7').style.display = "none";
    document.getElementById('login_item_spacer').style.display = "none";
}

function loggedIn(name)
{
    //alert('Successful Login! User: ' + name);
    document.getElementById('item7').style.display = "none";
    document.getElementById('login_item_spacer').style.display = "none";
    document.getElementById('item_right').style.display = "none";
    //document.getElementById('login_wrap').style.display = "inline";
    document.getElementById('menu_legend').style.display = "none";
    document.getElementById('logged_in').style.display = "inline";
    document.getElementById('logout_item_spacer').style.display = "inline";
    document.getElementById('item9').style.display = "inline";
    document.getElementById('logged_in_user').innerHTML = name;
}



function showLogin()
{
    document.getElementById('login_button_wrap').style.display = "inline";
    document.getElementById('login_password').style.display = "inline";
    document.getElementById('login_username').style.display = "inline";
    document.getElementById('menu_legend').style.display = "inline";
    document.getElementById('login_fail').style.display = "none";
    document.getElementById('logout_item_spacer').style.display = "none";
    document.getElementById('item9').style.display = "none";
    document.getElementById('item7').style.display = "inline";
    document.getElementById('logged_in').style.display = "none";
    document.getElementById('login_item_spacer').style.display = "inline";
    initLogin();
}

function whichButton(div) 
{
	if (event.keyCode == 13) 
	{
	/*
		if(div = "viewPasswordTxtBox")
		{
		    alert("menu login enter pressed");
		    //document.getElementById("viewLoginButton").click();
		}
		else if(div = "viewPasswordTxtBox2")
		{
		    alert("overlay login enter pressed");
		    //document.getElementById("viewLoginButton2").click();
		}
		else if(div = "viewSearchTxtBox")
		{
		    //document.getElementById("viewSearchButton").click();
		}
		*/
	}
}

function verifyPassword()
{
    
    var a = document.getElementById('ctl00_ContentPlaceHolder1_viewPwordTxtBox').value;
    var b = document.getElementById('ctl00_ContentPlaceHolder1_viewPwordRptTxtBox').value;
    
    if(a == b)
    {
        document.getElementById('pword_varified_text').innerHTML = "Password Varified";
        document.getElementById('pword_varified_text').style.color = "green";
    }
    else
    {
        document.getElementById('pword_varified_text').innerHTML = "Password Unvarified";
        document.getElementById('pword_varified_text').style.color = "red";
    }
    
}


// Auto-Scroll
function initContact()
{
    document.getElementById('contact_right').style.display = "none";
    box = document.getElementById('contact_wrap');
    contact = document.getElementById('contact_item');
    //username = document.getElementById('login_username');
    //pword = document.getElementById('login_password');
    //logbtn = document.getElementById('login_button_wrap');
    
    box.style.display = "inline";
    box.style.width = "0px";
    
    contact.style.opacity = "0.0";
    contact.style.MozOpacity = "0.0";  
    contact.style.filter  = "alpha(opacity='0')";
    /*
    pword.style.opacity = "0.0";
    pword.style.MozOpacity = "0.0";  
    pword.style.filter  = "alpha(opacity='0')";
    logbtn.style.opacity = "0.0";
    logbtn.style.MozOpacity = "0.0";  
    logbtn.style.filter  = "alpha(opacity='0')";*/
    
    animateContact();

}

function animateContact()
{
    var curWidth = parseInt(box.style.width);
    
    if(curWidth >= 990)
    {
         fadeContact();
    }
    else
    {
        box.style.width = parseInt(box.style.width)+18+'px';
        setTimeout(animateContact,5);
    }  
}

function fadeContact()
{
    contact.style.display = "inline";
   // pword.style.display = "inline";
    //logbtn.style.display = "inline";
    
    var curOpacity = parseFloat(contact.style.opacity) * 100;
    //alert('curOpacity = ' + parseFloat(username.style.opacity));
    //alert('times 100 = ' + curOpacity);
    
    if(curOpacity >= 100)
    {
    
    }
    else
    {
        curOpacity += 10;
        
       contact.style.opacity = curOpacity / 100;
        contact.style.MozOpacity = curOpacity / 100;  
        contact.style.filter  = "alpha(opacity=" + curOpacity + ")";
        /* 
        pword.style.opacity = curOpacity / 100;
        pword.style.MozOpacity = curOpacity / 100;  
        pword.style.filter  = "alpha(opacity=" + curOpacity + ")";
        logbtn.style.opacity = curOpacity / 100;
        logbtn.style.MozOpacity = curOpacity / 100;  
        logbtn.style.filter  = "alpha(opacity=" + curOpacity + ")";*/

        setTimeout(fadeContact,10);
    }    
}

function showAdminLink()
{
    document.getElementById("admin_item").style.display = "inline";
    document.getElementById("admin_item_spacer").style.display = "inline";
}

function fileUploadError()
{
    document.getElementById("upload_video_replace").style.display = "inline";
    document.getElementById("file_upload_wrap").style.display = "none";
    document.getElementById("upload_video_replace").innerHTML = "The file was not uploaded.";
}

function initUploadFlash()
{
   document.getElementById('upload_video_replace').style.display = 'inline';
   document.getElementById('file_upload_wrap').style.display = 'none';
   document.getElementById('input_button_wrap').style.display = 'none';
   var fo = new FlashObject('LoadingFlash.swf', 'loadingflash', '291', '25', '8.0', '#1e1e1e', true);
   fo.addParam('wmode', 'transparent');
   fo.write('upload_video_replace');
   document.getElementById('ctl00_ContentPlaceHolder1_viewUploadVideoListBtn').click();
}

function reinitUploadFlash()
{
   document.getElementById('upload_video_replace').style.display = 'none';
   document.getElementById('file_upload_wrap').style.display = 'inline';
   document.getElementById('input_button_wrap').style.display = 'inline';
   
}

function initializeAutoPicFlash(Title, Name1, Pic1, Name2, Pic2, CompID)
{
            
			var flashvars = {};
			flashvars.toptitle = Title;
            flashvars.name1 = Name1;
            flashvars.pic1 = Pic1;
            flashvars.name2 = Name2;
            flashvars.pic2 = Pic2;
            flashvars.compid = CompID;
			var params = {};
			params.wmode = "transparent";
			var attributes = {};
			
			swfobject.embedSWF("autoPicScript3.swf", "autoPicScriptWrite", "480", "298", "9.0.0","expressInstall.swf", flashvars, params);
            
            //alert('i ran too!');
}

function initializeVideo(CpCode, VideoFile, VideoTitle, VideoDescription, ShowAd, VideoID)
			{
			
				var flashvars = {};
				
				//////////////////////////////////////////////////////////////////////////////////////////////////////
				// CUSTUMIZABLE PARAMETERS ///////////////////////////////////////////////////////////////////////
				//////////////////////////////////////////////////////////////////////////////////////////////////////
				
				// video width
				var stageW = 600;
				var stageH = 400;
				
				flashvars.cpCode = CpCode;
				flashvars.imagePath	= "no_thumb.jpg";
				flashvars.videoPath = VideoFile;
				flashvars.title = VideoTitle;
				flashvars.description = VideoDescription;
				flashvars.showAd = ShowAd;
				flashvars.videoID = VideoID;
				flashvars.viewInfoButton 		=	"true";
				flashvars.viewFullscreenButton 	=	"true";
				flashvars.viewScaleButton 		=	"false";
				flashvars.viewVolumeControls 	=	"true";
				flashvars.viewTime				=	"true";
				flashvars.viewBigPlayButton 	=	"true";
				flashvars.viewRightClickMenu 	=	"true";
				flashvars.mouseHide				=	"true";
				flashvars.mouseHideTime			=	"3";
				flashvars.doubleClick			=	"true";
				flashvars.oneClick				=	"true";
				flashvars.spaceKey				=	"true";
				flashvars.videoLoop			=	"false";
				flashvars.videoAutoPlay		=	"false";
				flashvars.videoBufferTime	=	"3";	
				flashvars.tlInterval		=	"10000";
				flashvars.soundVolume		=	"0.8";
				flashvars.fullSizeView		=	"3";
				flashvars.spacing 			=	"10";
				flashvars.controlHeight		=	"25";
				flashvars.volumeLengthW		= 	"50";
				flashvars.color1 			= 	"0x2e2e2e";
				flashvars.color2 			= 	"0x000000";
				flashvars.alpha1 			= 	"1";
				flashvars.alpha2 			= 	"1";
				flashvars.borderColor 		= 	"0x555555";
				flashvars.borderAlpha		= 	"1";
				flashvars.timeColor1		= 	"0x333333";
				flashvars.timeColor2		= 	"0x111111";
				flashvars.timeAlpha1		= 	"1";
				flashvars.timeAlpha2		= 	"1";
				flashvars.timeTextColor1	= 	"0xffffff";
				flashvars.timeTextColor2	= 	"0x888888";
				flashvars.scrubberHeight 	=	"3";
				flashvars.scrubberColor1	= 	"0x333333";
				flashvars.scrubberAlpha1	= 	"1";
				flashvars.scrubberColor2	= 	"0x47d2ff";
				flashvars.scrubberAlpha2	= 	"1";
				flashvars.filterColor		= 	"0x0066ff";
				flashvars.filterAlpha		= 	"1";
				flashvars.titleColor			=	"0x47d2ff";
				flashvars.descriptionColor		=	"0xD3D3D3";
				flashvars.infoBackgroundColor	=	"0x000000";
				flashvars.infoBackgroundAlpha	=	"0.5";
				
				//////////////////////////////////////////////////////////////////////////////////////////////////////
				//////////////////////////////////////////////////////////////////////////////////////////////////////
				//////////////////////////////////////////////////////////////////////////////////////////////////////
				
				var params = {};
				params.scale = "noscale";
				params.allowfullscreen = "true";
				params.salign = "tl";
				params.bgcolor = "000000";
				
				var attributes = {};
				
				//alert('before embed');
				
				swfobject.embedSWF("video-player-snapshot.swf", "video_player_flash", stageW, stageH, "9.0.0", false, flashvars, params, attributes);
				
				//alert('after embed');
			}






