// JavaScript Document
ind_c = 0;

pic_id = new Array("pic_together","pic_ipad","pic_video");
a_id = new Array("gallery-together","gallery-ipad","gallery-video");

news_index=0;

cicle_num = 0;

var t;

/*get key word focus*/
function trim(stringToTrim) {
				var trm =  stringToTrim.split(' ').join('');
				 return trm.toLowerCase();
				//return stringToTrim.replace(/^\s+|\s+$/g,"");
		}		
		
		
function GetQueryString(name) 
{ 
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); 
var r = document.referrer.substr(1).match(reg); //window.location.search.substr(1).match(reg); 
if (r!=null) return unescape(r[2]); return null; 
} 

function getkeywords() {
		
		var x = document.referrer;		
			if(x == ""|| x=="null"){
						return x;
				}
				else{					
					var strReplace = "+";
					x = x.replace(strReplace," ");
					x = trim(x);
					return x; 
				}
		}
		
function CompareSearchKey()	{
			
			//var keyVal = getkeywords();
			//keyVal = keyVal.toLowerCase();
			//keyVal =new RegExp(keyVal, "i");
			
			keyVal=""
			keyVal = getkeywords();
			if (keyVal==null) keyVal="";

			
var imgExist;

var imgArr = new Array("image1","image2","image3");

//web meeting
var image1 = new Array("Webconferencing","Online-Meeting","Web-Meeting","DesktopSharing","sharedesktop","FileSharing","ApplicationSharing","webexmeeting","webexmeetingcenter");

//mobile
var image2 = new Array("webexmobile","webexformobile","webexandmobiles","wEbex for moBiLe","webexmobile","webexiphone","webexipad","webexsmartphones","mobilevideoconferencing","mobileremotedesktopsoftware");

//video
var image3 = new Array("Videoconferencing","Videoconference","webex video","Video webex","highqualityvideo","WebcamVideo","highqualityvideo","highqualityvideoconferencing","highquality","highqualityvideoconferencing","highqualityvideoconferencing","webexhighqualityvideoconferencing","webexhqvideoconferencing","webexmeetingcenterhighquality");

//training
//var image5 = new Array("webex for elearning","elearning with webex","webex elearning","web ex elearning","webx elearning","webex e-learning","try webex elearning","webex elearning trial","elearning software","education video conferencing","educational video conferencing","educational videoconferencing","education webcast","e learning","elearning provider","e learning software","elearning software","elearning software companies","software for e learning","software for elearning","free elearning software","download elearning software","elearning software trial","easy elearning software","effective elearning software","elearning software demonstration","affordable elearning software","interactive online training","online learning training","online training companies","online training system","web based training","web based training company","video conferencing for learning","video conferencing in education","best web based training","web based training development","web based training system");

if(keyVal!="") {
	for(i=0;i<imgArr.length;i++){
		var imgArrName = imgArr[i];
		switch(imgArrName){
		case "image1":
			if(image1.toString().replace(/ /g,'').search(keyVal)!=-1){
			imgExist=0;
			}
			break;
		case "image2":
			if(image2.toString().replace(/ /g,'').search(keyVal)!=-1){
			imgExist=1;
			}
			break;
		case "image3":
			if(image3.toString().replace(/ /g,'').search(keyVal)!=-1){
			imgExist=2;
			}
			break;
			default : '';
		}
	}
}

if(imgExist){
	return imgExist;
}else{
	return 0;
}			
			
}


/*end key word*/


function slideSwitch() {

	ind_n = ind_c + 1;
	if (ind_n == 3) ind_n = 0;
	
	$("#"+pic_id[ind_c]).fadeOut(500);
	$("#"+pic_id[ind_n]).fadeIn(500);
	$("#"+a_id[ind_c]).removeClass("gallery-current");
	$("#"+a_id[ind_n]).addClass("gallery-current");
	
	//campaing_count(a_id[ind_n]);
	
	ind_c = ind_c + 1;
	if (ind_c == 3) ind_c = 0;
	
	cicle_num = cicle_num +1;
	if (cicle_num == 3){
		if (t)		clearInterval(t);
	}

}

function newSwitch() {
		clearInterval(n);
		$("#news-ticker .news").eq(news_index).hide();
		if(news_index == 2){news_index=0;}
		else {news_index = news_index+1;}
		$("#news-ticker .news").eq(news_index).show();
		n=setInterval( "newSwitch()", 5000 );
}

var n;
$(function() {
	//$("#slideshow span").css({"opacity":"0.7","display":"block"});

	$("#slideshow").append("<div id='tray'><table border='0' cellpadding='0' cellspacing='0' height='33' id='tb-tray' width='280'><tr><td align='left' width='140'><a href='javascript:void(0);' id='gallery-together'><span class='gallery-text'>WebEx Meetings</span></a></td>      <td align='left' width='140'><a href='javascript:void(0);' id='gallery-ipad'><span class='gallery-text'>WebEx for iPad</span></a></td><td align='left' width='140'><a href='javascript:void(0);' id='gallery-video'><span class='gallery-text'>High-Quality Video</span></a></td></tr></table></div><div id='pic_together'><span class='meetings current'><H1 class='hero-title'>Meet with anyone, anywhere</H1><p class='hero-subtitle' align='left'>Get more done, faster,<br>online with WebEx.</p><table align='left' border='0' cellpadding='0' cellspacing='0' width='320'><tr><td width='140' align='left'><table border='0' cellpadding='0' cellspacing='0' width='122'><tr><td width='122'><a class='cta-buy'  id='Together_Buy' href='http://www.webex.com.au/go/au_buy_mc'>Buy Now</a></td></tr></table></td><td width='180' align='left'><table border='0' cellpadding='0' cellspacing='0' width='142'><tr><td width='142'><a class='cta-ft' href='http://www.webex.com.au/go/au_webex_ft' id='Together_FT'>Try It Free</a></td></tr></table></td></tr></table><p align='left' class='hero-learnmore'><br>Or <a href='/overview/index.html'>learn more</a> about WebEx online meetings</p></span></div><div id='pic_ipad'><span class='ipad'><H1 class='hero-title'>Join WebEx meetings on your Apple iPad</H1><p class='hero-subtitle' align='left'>Make sure WebEx is easily accessible—wherever you are—with our free application.</p><table align='left' border='0' cellpadding='0' cellspacing='0' width='320'><tr><td width='140' align='left'><table align='left' border='0' cellpadding='0' cellspacing='0' width='122'><tr><td width='122'><a class='cta-buy' href='/overview/mobile-meetings.html'  id='Ipad_LearnMore'>Learn more</a></td></tr></table></td><td width='180' align='left'><table border='0' cellpadding='0' cellspacing='0' width='142'><tr><td width='142'><a class='cta-ft2' id='Ipad_FT' href='http://www.webex.com.au/go/au_webex_ft'>Try WebEx Free</a></td></tr></table></td></tr></table></span></div><div id='pic_video'><span class='video'><H1 class='hero-title'>Bring meetings to life with WebEx high-quality video</H1><p align='left' class='hero-subtitle'>Create a true  meeting experience with high-quality video.</p><table align='left' border='0' cellpadding='0' cellspacing='0' width='320'><tr><td width='140' align='left'><table border='0' cellpadding='0' cellspacing='0' width='122'><tr><td width='122'><a class='cta-buy' href='http://www.webex.com.au/go/au_buy_mc' id='Video_Buy'>Buy Now</a></td></tr></table></td><td width='180' align='left'><table border='0' cellpadding='0' cellspacing='0' width='142'><tr><td width='142'><a class='cta-ft' id='Video_FT1' href='http://www.webex.com.au/go/au_webex_ft'>Try It Free</a></td></tr></table></td></tr></table><p class='hero-learnmore' align='left'><br />Or <a href='/overview/video-conferencing.html'>learn more</a> about WebEx high-quality video</p></span></div>");
	
	//$(".current").css("opacity","1.0");

	
	$("#news-ticker .news:first").show();
	

	
	keynum=CompareSearchKey(); 
	switch(keynum)
	{
		
		case 0:
				ind_c = 0;
				break;

		case 1:
				ind_c = 1;
				break;
		default:
				ind_c = 0;
				break;
	}
	

	$("#"+pic_id[ind_c]).fadeIn();
	$("#"+a_id[ind_c]).addClass("gallery-current");

	//campaing_count(a_id[ind_c]);
	
	var b_v = navigator.appVersion;
	var IE6 = b_v.search(/MSIE 6/i) != -1;

	if (IE6)
	{
		DD_belatedPNG.fix('img, #tray, #news-ticker, #left-arrow, #right-arrow, #pod1, #pod2, #pod3');  
	} 
	
	
    n=setInterval( "newSwitch()", 5000 );	
    t=setInterval( "slideSwitch()", 5000 );
	
	

	$("#gallery-together").click( function() {
		if (t)		clearInterval(t);
		if (ind_c != 0){
			$("#"+pic_id[ind_c]).fadeOut(500);
			$("#"+pic_id[0]).fadeIn(500);
			$("#"+a_id[ind_c]).removeClass("gallery-current");
			$("#"+a_id[0]).addClass("gallery-current");
		}
		ind_c = 0;
		//thumbnail_click('together');

	});	
			
	$("#gallery-ipad").click( function() {
		if (t)		clearInterval(t);
		if (ind_c != 1){
			$("#"+pic_id[ind_c]).fadeOut(500);
			$("#"+pic_id[1]).fadeIn(500);
			$("#"+a_id[ind_c]).removeClass("gallery-current");
			$("#"+a_id[1]).addClass("gallery-current");
		}
		ind_c = 1;
		//thumbnail_click('ipad');
		
	});
		
	$("#gallery-video").click( function() {
		if (t)		clearInterval(t);
		if (ind_c != 2){
			$("#"+pic_id[ind_c]).fadeOut(500);
			$("#"+pic_id[2]).fadeIn(500);
			$("#"+a_id[ind_c]).removeClass("gallery-current");
			$("#"+a_id[2]).addClass("gallery-current");
		}
		ind_c = 2;
		thumbnail_click('HQ-video');

	});
	
	$("#left-arrow").click( function(event) {
		event.preventDefault();
		$("#news-ticker .news").eq(news_index).hide();
		if(news_index == 0){news_index=2;}
		else {news_index = news_index-1;}
		$("#news-ticker .news").eq(news_index).show();
	});
	
	$("#right-arrow").click( function(event) {
		event.preventDefault();
		$("#news-ticker .news").eq(news_index).hide();
		if(news_index == 2){news_index=0;}
		else {news_index = news_index+1;}
		$("#news-ticker .news").eq(news_index).show();
	});
	
});

/*
$("#Together_Buy").click( function() {
		learnmore_click("Together_Buy");
});
$("#Sign_Up").click( function() {
		learnmore_click("Sign_Up");
});
$("#Together_FT").click( function() {
		learnmore_click("Together_FT");
});
$("#Ipad_LearnMore").click( function() {
		learnmore_click("Ipad_LearnMore");
});
$("#Ipad_FT").click( function() {
		learnmore_click("Ipad_FT");
});
$("#Video_Buy").click( function() {
		learnmore_click("Video_Buy");
});
$("#Video_LearnMore").click( function() {
		learnmore_click("Video_LearnMore");
});
*/

//	************************** OMNITURE CODE  [BEGINS] ************************************************//	
function campaing_count(camp_ids){ //alert(camp_ids)
		s.linkTrackVars="prop30,eVar30";
		s.eVar30 = "wx:uk:home:home:hero:alt1:"+camp_ids;
		s.prop30 = "wx:uk:home:home:hero:alt1:"+camp_ids;
		void s.tl(this,'o',camp_ids);	
	}	
 //function campaing_count to track which campaign is currently showing in the frame 


	
	// function thumbnail_click is for the ThumbNail and ThumbText Click
	function thumbnail_click(id_thumb){	
		s.linkTrackVars="prop30,eVar30";
		s.eVar30 = "wx:uk:home:home:hero:alt1:"+id_thumb;
		s.prop30 = "wx:uk:home:home:hero:alt1:"+id_thumb;
        var LinkName= "wx:uk:hero:alt1:thumbclick:"+id_thumb;	
	    void s.tl(this, 'o', LinkName);
		
	}
	//function learnmore_click for the LearMore link Click 
	function learnmore_click(linkVal){ 
		 var linkNames = linkVal;
		 s.pageName = "wx:uk:home:home:hero:alt1:"+linkNames+":link:learnmore";
		 s.prop30   = ""; 
		 s.eVar30   = "wx:uk:home:home:hero:alt1:"+linkNames+":link:learnmore"; 
		 void s.t();	
	}

	
//	************************** OMNITURE CODE [ENDS] ************************************************//	
