﻿/*community*/
var img_home_community_unique_off = new Image();
img_home_community_unique_off.src = "images/content/home/community/unique_off.jpg";
var img_home_community_unique_on = new Image();
img_home_community_unique_on.src = "images/content/home/community/unique_on.jpg";
var img_home_community_neighbor_off = new Image();
img_home_community_neighbor_off.src = "images/content/home/community/neighbor_off.jpg";
var img_home_community_neighbor_on = new Image();
img_home_community_neighbor_on.src = "images/content/home/community/neighbor_on.jpg";

var community_tab_images = new Array ( "imgHomeCommunityUnique", "imgHomeCommunityNeighbor" );
var community_tabs = new Array( "img_home_community_unique", "img_home_community_neighbor" );
var community_tab_content = new Array ( "community_tab_content_unique", "community_tab_content_neighbor" );


function HomeIFrame_ButtonRollover (id, imgSrc){
	var elem = window.frames['ifrm_tertiary_content'].document.getElementById ( id );	
	elem.src = eval ( imgSrc + ".src" );	
}

function HomeIFrame_TabClick (id, imgSrc, contentId){
	var content_type = 'community';
	if( contentId.search(/collection/i) > -1 )
	{
		content_type = 'collection';
	}
	
	HomeIFrame_ResetTabs( content_type );	

	var elem = window.frames['ifrm_tertiary_content'].document.getElementById ( id );	
	elem.src = eval ( imgSrc + ".src" );
	
	var content_elem = window.frames['ifrm_tertiary_content'].document.getElementById ( contentId );
	content_elem.style.display = 'block';
}

function HomeIFrame_ResetTabs ( type ){
	var tab_images;
	var tabs;
	var tab_content;

	if( type == 'community' )
	{
		tab_images = community_tab_images;
		tabs = community_tabs;
		tab_content = community_tab_content;
	}
	
	for (var i = 0; i < tab_images.length; i++ )
		{
			var elem = window.frames['ifrm_tertiary_content'].document.getElementById ( tab_images[i].toString( ) );	
			elem.src = eval ( tabs[i].toString( ) + "_off.src" );
			
			var content_elem = window.frames['ifrm_tertiary_content'].document.getElementById ( tab_content[i].toString( ) );	
			content_elem.style.display = 'none';
		}
}

function HomeIFrame_OpenEmailWindow ( ){
	var url = '/cfm/home/collection/emailfriend.html';
	var name = 'Send_Email_to_Friend';
	var attr = 'location=0,resizable=0,scrollbars=0,width=470,height=479';
	
	var winl = (screen.width - 470) / 2;
    var wint = (screen.height - 479) / 2;
    
    attr += ',top=' + wint + ',left=' + winl;
    
    window.open(url, name, attr);
}

function HomeIFrame_OpenDesignHomeDetailWindow ( ){
	var url = '/cfm/home/designhome/homedetail.html';
	var name = 'Designer_Home_Detail';
	var attr = 'location=0,resizable=0,scrollbars=0,width=550,height=320';
	
	var winl = (screen.width - 550) / 2;
    var wint = (screen.height - 320) / 2;
    
    attr += ',top=' + wint + ',left=' + winl;
    
    window.open(url, name, attr);
}

/*HOME COLLECTION SECTION*/
function HomeIFrame_CollectionTabClick (id){
	var collections_array = window.frames['ifrm_tertiary_content'].document.getElementById ( 'hidCollections' ).value.toString( ).split( '|' );	
	for(var i = 0; i < collections_array.length; i++ )
	{
		var tab = window.frames['ifrm_tertiary_content'].document.getElementById ( 'tab_' + collections_array[i].toString( ) );
		var content = window.frames['ifrm_tertiary_content'].document.getElementById ( 'collection_tab_content_' + collections_array[i].toString( ) );
		if(collections_array[i].toString( ) == id)
		{
			tab.className = 'tab_on';
			content.style.display = 'block';
		}
		else
		{
			tab.className = 'tab_off'; 
			content.style.display = 'none';
		}
	}	
}

function HomeIFrame_CollectionModelRollover(hidID, modelID){
	var models_array = window.frames['ifrm_tertiary_content'].document.getElementById ( hidID ).value.toString( ).split( '|' );	
	for(var i = 0; i < models_array.length; i++ )
	{
		var model = window.frames['ifrm_tertiary_content'].document.getElementById ( 'model_' + models_array[i].toString( ) );		
		if(model.className != 'model_on_set')
		{
			if(modelID == models_array[i].toString( ))
			{
				if(model.className == 'model_on')
				{
					model.className = 'model_off';
				}
				else
				{
					model.className = 'model_on';
				}
			}
		}
	}
}

function HomeIFrame_CollectionModelClick(hidID, modelID){
	var models_array = window.frames['ifrm_tertiary_content'].document.getElementById ( hidID ).value.toString( ).split( '|' );	
	for(var i = 0; i < models_array.length; i++ )
	{
		var model = window.frames['ifrm_tertiary_content'].document.getElementById ( 'model_' + models_array[i].toString( ) );		
		if(models_array[i].toString( ) == modelID)
		{
			model.className = 'model_on_set';
		}
		else
		{
			model.className = 'model_off';
		}
	}
}
