/*!
 *
 * Copyright (c) 2010 TIEBUSA DESIGN (http://www.tiebusa.com)
 *
 * Built on top of the jQuery library
 * http://jquery.com
 *
 * Global items v1.1
 * Last update: Frederick Yau 20100726;
 *
 */
var isIE = document.all ? true : false;
var isIE6 = navigator.userAgent.toLowerCase().indexOf('msie 6') != -1;
var loc = document.location.toString();	
var isEnglish = !!!(loc.search("/eng/")+1);	

var switchLanguage=function(l){	
	if (l == 'eng') return;
	if(isEnglish){
		document.location = loc.replace("/cht/","/eng/");
	} else {
		document.location = loc.replace("/eng/","/cht/");
	}
}
///////////////////////////////////////////////////////////////
// tbs_Animate_menu
///////////////////////////////////////////////////////////////
var menuovering = false;
var menuTimer = null;
function hideMenu() {	
	if (menuovering) {	   
		$('#menuplane').slideUp(100); 
		menuovering = false;
	}
}
function highlightSection(id) {
	
}
function tbs_Animate_menu(){
var greyColor = '#565656';
var redColor = '#df1522';
var i = 1;
$("#navmenuh>li").each(function(){
	this.pid = i; i++; });
i = 1;
$("#menuplane>ul").each(function(){ this.pid = i; i++; });
 $("#navmenuh>li").mouseover(function(){
	if (!menuovering) {
		$('#menuplane').css({visibility: "visible",display: "none"}).slideDown(200);
		menuovering = true;
	}
	clearTimeout(menuTimer);
 });
$("#navmenuh>li").mouseout(function(){
	menuTimer = setTimeout(hideMenu, 300);
});
$("#menuplane").bind("mouseenter",function(){
	clearTimeout(menuTimer);
}).bind("mouseleave",function(){
	menuTimer = setTimeout(hideMenu, 300);
});
if (isIE6) {
	$("#menuplane>ul").hover(function(){	
	var thePlane = $('#menuplane ul.sec'+ this.pid + ' a').parent().parent();
	thePlane.css('background-color', redColor);
	$('#menuplane ul.sec'+ this.pid + ' a').css({color: 'white'});
	$('#menuplane ul.sec'+ this.pid + ' li').css({color: 'white'});
	$('#menuplane ul.sec'+ this.pid + ' li ul li a').css({color: 'white'});
	$('#menuplane ul.sec'+ this.pid + ' li ul li a').css({"background-image":"url("+path+"images/common/nav_bull2.gif)"});	
	$('#navmenuh li.sec'+ this.pid + ' a').css({color: redColor});	
}, function(){	
	$('#menuplane ul.sec'+ this.pid + ' a').parent().parent().css('background-color', "transparent");
	$('#menuplane ul.sec'+ this.pid + ' a').css({color: greyColor});
	$('#menuplane ul.sec'+ this.pid + ' li').css({color: greyColor});
	$('#menuplane ul.sec'+ this.pid + ' li ul li a').css({color: greyColor});
	$('#menuplane ul.sec'+ this.pid + ' li ul li a').css({"background-image":"url("+path+"images/common/nav_bull1.gif)"});	
	if (section != this.pid) {
		$('#navmenuh li.sec'+ this.pid + ' a').css({color: greyColor});
	}
});
} else {
	$("#menuplane>ul").hover(function(){
		$('#navmenuh li.sec'+ this.pid + ' a').css({color: redColor});	
	}, function(){
		if (section != this.pid) {
			$('#navmenuh li.sec'+ this.pid + ' a').css({color: greyColor});
		}
	});
}
$("#navmenuh>li").hover(function(){
	$('#navmenuh>li.sec'+ this.pid + ' a').css({color: redColor});
}, function(){
	if (section != this.pid) {
		$('#navmenuh>li.sec'+ this.pid + ' a').css({color: greyColor});
	}
});
$('#navmenuh>li.sec'+ section + ' a').css({color: redColor});

if (isIE6) {
	 try {
	   document.execCommand("BackgroundImageCache", false, true);
	} catch (e) {}
	$("#navmenuh>li a").css({color: greyColor});

}
return;
}


function menuToggle() {
	
}

function buildTop() {
//	alert('buildTop() is called');
tmpHtml = '';
tmpHtml += '  <ul class="wf-menu" id="navmenuh">';
tmpHtml += '    <li class="sec1"><a href="javascript:menuToggle();">About Us</a></li>';
tmpHtml += '    <li class="sec2"><a href="javascript:menuToggle();">Our Films</a></li>';
tmpHtml += '    <li class="sec3"><a href="javascript:menuToggle();">Toon Express</a></li>';
tmpHtml += '    <li class="sec4"><a href="javascript:menuToggle();">iDream</a></li>';
tmpHtml += '    <li class="sec5"><a href="javascript:menuToggle();">Press Room</a></li>';
tmpHtml += '    <li class="sec6"><a href="javascript:menuToggle();">Investor Relations</a></li>';
tmpHtml += '    <li class="sec7"><a href="javascript:menuToggle();">Community</a></li>';
tmpHtml += '  </ul>';
tmpHtml += '  <div id="menuplane">';
tmpHtml += '    <ul class="sec1">';
tmpHtml += '      <li><a href="'+path+'about-us/the-company.html" class="current">The Company</a></li>';
tmpHtml += '      <li><a href="'+path+'about-us/board-of-directors.php">Board Of Directors</a></li>';
tmpHtml += '      <li><a href="'+path+'about-us/senior-management.php">Senior Management</a></li>';
tmpHtml += '      <li><a href="'+path+'about-us/corporate-governance.html">Corporate Governance</a></li>';
//tmpHtml += '      <li><a href="'+path+'about-us/history.html">History</a></li>';
tmpHtml += '    </ul>';
tmpHtml += '    <ul class="sec2">';
//tmpHtml += '      <li><a href="'+path+'our-films/gatchaman.html">Gatchaman</a></li>';
tmpHtml += '      <li><a href="'+path+'our-films/cat-tale.html">Cat Tale</a></li>';
tmpHtml += '      <li><a href="'+path+'our-films/astro-boy.html">Astro Boy</a></li>';
tmpHtml += '      <li><a href="'+path+'our-films/tmnt.html">TMNT</a></li>';
tmpHtml += '      <li><a href="'+path+'our-films/highlander.html">Highlander</a></li>';
tmpHtml += '      <li><a href="'+path+'our-films/library.html">LIBRARY</a></li>';
tmpHtml += '    </ul>';
tmpHtml += '    <ul class="sec3">';
tmpHtml += '      <li><a href="'+path+'toon-express/toon-express.html">Corporate Information</a></li>';
tmpHtml += '      <li><a href="'+path+'toon-express/toon-express_02.html">Vision</a></li>';
tmpHtml += '      <li><a href="'+path+'toon-express/toon-express_03.html">Franchises</a></li>';
tmpHtml += '    </ul>';
tmpHtml += '    <ul class="sec4">';
tmpHtml += '      <li><a href="'+path+'idream/special-effect.html">Special Effect Projects</a></li>';
tmpHtml += '      <li><a href="'+path+'idream/show-reel.html">Show Reel</a></li>';
//tmpHtml += '      <li><a href="'+path+'idream/asset-lib.html">CG Model Library</a></li>';
tmpHtml += '    </ul>';
tmpHtml += '    <ul class="sec5">';
tmpHtml += '      <li><a href="'+path+'press-room/press-releases.php">Press Releases</a>';
tmpHtml += '        <ul>';
tmpHtml += '          <li><a href="'+path+'press-room/corporate-development.php">Corporate Development</a></li>';
tmpHtml += '          <li><a href="'+path+'press-room/business-development.php">Business Development</a></li>';
tmpHtml += '        </ul>';
tmpHtml += '      </li>';
tmpHtml += '      <li><a href="'+path+'press-room/contact.php">Media Contact</a></li>';
tmpHtml += '    </ul>';
tmpHtml += '    <ul class="sec6">';
tmpHtml += '      <li><a href="'+path+'investor-relations/annual-interim-reports.php">Annual / Interim Reports</a></li>';
tmpHtml += '      <li><a href="'+path+'investor-relations/announcements.php">Announcements</a>';
tmpHtml += '        <ul>';
tmpHtml += '          <li><a href="'+path+'investor-relations/announcements-and-notices.php">Announcements and Notices</a></li>';
tmpHtml += '          <li><a href="'+path+'investor-relations/circulars.php">Circulars</a></li>';
tmpHtml += '          <li><a href="'+path+'investor-relations/returns-on-share-capital.php">Returns on Share Capital</a></li>';
tmpHtml += '        </ul>';
tmpHtml += '		</li>';
tmpHtml += '      <li><a href="'+path+'investor-relations/contact.php">Contact</a></li>';
tmpHtml += '    </ul>';
tmpHtml += '    <ul class="sec7">';
tmpHtml += '      <li><a href="'+path+'community/training.html">Training</a></li>';
tmpHtml += '      <li><a href="'+path+'community/hkada.html">HKADA</a></li>';
tmpHtml += '      <li><a href="'+path+'community/skyhigh.html">SkyHigh</a></li>';
tmpHtml += '      <li><a href="'+path+'community/changing-young.html">Changing Young Lives Foundation</a></li>';
tmpHtml += '      <li><a href="'+path+'community/eag.html">East Asian Games (EAG)</a></li>';
tmpHtml += '    </ul>';
tmpHtml += '  </div>';
$("#nav").html(tmpHtml);
if (!isIE6 || true) { tbs_Animate_menu(); 
}
return;
}
function buildBread() {
	if (section == 0) {
		return
	} 		
	// YAU added 20100703
	var tmpHtml = '';	
	var l = sectionArray.length;
	for (var i=0; i < l; i++) {
		var item =  sectionArray[i];
		if (section != (1+i) ) {
			continue;
		}
		tmpHtml += '  <span class="level1">'+ item.caption +'</span>';
		if (item.subSection) {
			var l2 = item.subSection.length;
			tmpHtml += '  &gt;  ';
			for (var j=0; j < l2; j++) {					
				var item2 =  item.subSection[j];				
				if (subsection != (1+j) ) {
					continue;
				}				
				if (item2.subSection) {
					if ((item2.id == section + '.' + subsection) && (!subsubsection)) {
						tmpHtml += '  <span rel="b'+item2.id+'" title="'+ item2.caption+'">'+ item2.caption +'</span>';	
					} else {
						tmpHtml += '  <a rel="b'+item2.id+'" title="'+ item2.caption+'" href="'+path+item2.link +'" target="'+item2.target+'">'+ item2.caption +'</a>';	
					}
					var l3 = item2.subSection.length;					
					for (var k=0; k < l3; k++) {					
						var item3 = item2.subSection[k];
						if (subsubsection != (1+k) ) {
							continue;
						}
						tmpHtml += '  &gt;  ';
						tmpHtml += item3.caption + ' ';										
					} // eof lvl3
				} else {
					tmpHtml += ' '+ item2.caption +' ';	
				}
			} // eof lvl2
		}	
	} // eof lvl1
	var e = document.getElementById('breadCrumbs');
	if (e) {
		e.innerHTML = tmpHtml;
		return
	}	
}
function buildFeatureBar() {
	//alert('buildFeatureBar() ');
	var flashvars_feab = {};
	flashvars_feab.path = path;
	flashvars_feab.xmlPath = path+'xml/';
	flashvars_feab.imagePath = path+'images/';
	flashvars_feab.swfPath = path+'images/swf/';
	flashvars_feab.section = section;
	
	var params_feab = {};
	params_feab.allowscriptaccess = "always";
	params_feab.wmode = "transparent";
	var attributes_feab = {};
	attributes_feab.id = "featurebarflash";
	swfobject.embedSWF(flashvars_feab.swfPath + "featurebar.swf?v=0.01", "featurebar", "1000", "110", "9.0.0", false, flashvars_feab, params_feab, attributes_feab);
}
function buildHomeScreen() {
	// buildHomeScreen is for only Home swf.
	//alert('buildHomeScreen() ');
	return;
	var tmpHtml = '';
	tmpHtml += '<img src="images/home/home.jpg" />';
	document.getElementById('mainscreen').innerHTML = tmpHtml;
	return;
	return;
	var flashvars_hb = {};
	flashvars_hb.path = path;
	flashvars_hb.xmlPath = path+'xml/';
	flashvars_hb.imagePath = path+'images/';
	flashvars_hb.swfPath = path+'images/swf/';
	flashvars_hb.section = section;
	
	var params_hb = {};
	params_hb.allowscriptaccess = "always";
	params_hb.wmode = "transparent";
	var attributes_hb = {};
	attributes_hb.id = "mainscreen_inner";
	swfobject.embedSWF(flashvars_hb.swfPath + "home.swf?v=0.01", "mainscreen_inner", "1000", "500", "9.0.0", false, flashvars_hb, params_hb, attributes_hb);
}
function buildSubLevelScreen() {
	try {
		var flashvars_sb = {};
		flashvars_sb.path = path;
		flashvars_sb.xmlPath = path+'xml/';
		flashvars_sb.imagePath = path+'images/';
		flashvars_sb.swfPath = path+'images/swf/';
		flashvars_sb.section = section;
		if (numsection) {
			flashvars_sb.numsection = numsection;
		}
		var params_sb = {};
		params_sb.allowscriptaccess = "always";
		params_sb.wmode = "transparent";
		var attributes_sb = {};
		attributes_sb.id = "mainscreen";
		swfobject.embedSWF(flashvars_sb.swfPath + "subscreen.swf?v=0.01", "mainscreen", "1000", "303", "9.0.0", false, flashvars_sb, params_sb, attributes_sb);
	} catch (e) {}
}
function buildMainScreen() {
	if (section != "0") {
		var tmpHtml = '';
		if (section.indexOf('.') > -1 ) {
			var sectionAry  = section.split('.')
			section = parseInt(sectionAry[0]);
			subsection = parseInt(sectionAry[1]);
			if (subsection == NaN) { subsection = null;}
			subsubsection = parseInt(sectionAry[2]);
			if (subsubsection == NaN) { subsubsection = null;}
		} else {
			section = parseInt(section);
			subsection = null;
		}		
		if (section && subsection && subsubsection ) {
			if (section == 2 && (subsection == 1 || subsection == 2 || subsection == 3 || subsection == 4 || subsection == 5 || subsection == 6 || subsection == 7)) {
				if ((subsection == 3 && subsubsection == 6) || (subsection == 4 && subsubsection == 2) || (subsection == 4 && subsubsection == 3) ||
				   (subsection == 4 && subsubsection == 4) || (subsection == 5 && subsubsection == 2) || (subsection == 6 && subsubsection == 3) ) {
					tmpHtml += '<img src="../images/screen/screen_'+ section + '_'+ subsection + '_'+ subsubsection + '.jpg" />';
				} else {
					tmpHtml += '<img src="../images/screen/screen_'+ section + '_'+ subsection + '.jpg" />';
				}
			} else {
				tmpHtml += '<img src="../images/screen/screen_'+ section + '_'+ subsection + '_'+ subsubsection + '.jpg" />';
			}			
		} else if (section && subsection) {
			tmpHtml += '<img src="../images/screen/screen_'+ section + '_'+ subsection + '.jpg" />';
		} else {
			tmpHtml += '<img src="../images/screen/screen_'+ section + '.jpg" />';
		}
		document.getElementById('mainscreen').innerHTML = tmpHtml;
		return;
		
	}
	buildHomeScreen();
}
function buildSideImageGallery() {
	var tmpHtml = '';
	
//	sideGalleryArray[subsection].id
//	sideGalleryArray[subsection].subSection[0].link
	var hideBoxStr = '';
	if ((section == 2 && subsection == 6) ||
		 (section == 2 && subsection == 1)) {
		hideBoxStr = ' style="display:none;"';
	}
	if (sideGalleryArray[subsection-1].subSection == null) {
		return tmpHtml;
	}
	tmpHtml += '  <div id="imagegallery" class="sb_imagegallery widget">';
	tmpHtml += '    <h2>Image Gallery</h2>';
	tmpHtml += '    <div class="sb_imagegallery_inner">';
	tmpHtml += '    <a target="_self" href="'+path+sideGalleryArray[subsection-1].subSection[0].link+'" title="Image Gallery"><img src="'+sideGalleryArray[subsection-1].subSection[0].img+'" /></a>';
	tmpHtml += '    </div>';
	tmpHtml += '    <h3>View Trailer</h3>';
	tmpHtml += '    <div class="sb_imagegallery_inner">';
	tmpHtml += '    <a target="_self" href="'+path+sideGalleryArray[subsection-1].subSection[1].link+'" title="View Trailer"><img src="'+sideGalleryArray[subsection-1].subSection[1].img+'" /></a>';
	tmpHtml += '    </div>';
	tmpHtml += '    <h3'+hideBoxStr+'>View Teaser</h3>';
	tmpHtml += '    <div'+hideBoxStr+' class="sb_imagegallery_inner">';
	tmpHtml += '    <a target="_self" href="'+path+sideGalleryArray[subsection-1].subSection[2].link+'" title="View Teaser"><img src="'+sideGalleryArray[subsection-1].subSection[2].img+'" /></a>';
	tmpHtml += '    </div>';
	tmpHtml += '  </div>';
	return tmpHtml;
}

function buildSideNav() {
var hideSideBar = false;
var tmpHtml = '';
var i = 0;

var isCurrentStr = ''; var found=false;
tmpHtml += '<div class="sidenav widget" id="sidenav"><div class="sidenavinner">';
tmpHtml += '<ul>';
if (section == 2 || (section == 8 && subsection == 1)) {	
	var l = sectionArray[section-1].subSection[subsection-1].subSection.length;
	for (var i=0; i < l; i++) {	
		var item =  sectionArray[section-1].subSection[subsection-1].subSection[i];
		
		if (subsubsection == (1+i) ) {
			isCurrentStr = ' class="current"'; 
		} else {
			isCurrentStr = '';
		}
		try {
			if (item.target != '_self') {			
				tmpHtml += '  <li><a id="sb'+i+'" title="'+ item.caption+'" href="'+item.link +'"'+isCurrentStr+' target="'+item.target+'"><b>'+ item.caption +'</b></a>';
				tmpHtml += '</li>';
			} else {			
				tmpHtml += '  <li><a id="sb'+i+'" title="'+ item.caption+'" href="'+path+item.link +'"'+isCurrentStr+' target="'+item.target+'"><b>'+ item.caption +'</b></a>';
				tmpHtml += '</li>';
			}
		} catch(err) {
			alert('ERRROR = ' + err);
		}
	}	
} else if (section == 8) {
	hideSideBar = true;
} else {
	var l = sectionArray[section-1].subSection.length;
	for (var i=0; i < l; i++) {
		var item =  sectionArray[section-1].subSection[i];

		if (subsection == (1+i) ) {
			isCurrentStr = ' class="current"'; 
		} else {
			isCurrentStr = '';
		}
		try {		
		tmpHtml += '  <li><a id="sb'+i+'" title="'+ item.caption+'" href="'+path+item.link +'"'+isCurrentStr+' target="'+item.target+'"><b>'+ item.caption +'</b></a>';		
		if (item.subSection) {
			var l2 = item.subSection.length;
			tmpHtml += '<ul>';
			for (var j=0; j < l2; j++) {					
				var item2 =  item.subSection[j];				
				if (isCurrentStr != '' && subsubsection == (1+j) ) {
					isCurrentStr2 = ' class="current"'; 
				} else {
					isCurrentStr2 = '';
				}	
				tmpHtml += '  <li><a id="sb'+i+'_'+j+'" title="'+ item2.caption+'" href="'+path+item2.link +'"'+isCurrentStr2+' target="'+item2.target+'"><b>'+ item2.caption +'</b></a></li>';	
			}
			tmpHtml += '</ul>';
		}		
		tmpHtml += '</li>';
		} catch (err) {
			alert('ERROR = ' + err);			
		}
	}	
}
tmpHtml += '</ul>';
tmpHtml += '  </div></div>';
tmpHtml += '  <!-- End of sidenav -->';	

if (!hideSideBar) {	
	if (section == 2) {
		tmpHtml += buildSideImageGallery();
	}
	isCurrentStr = '';
	tmpHtml += '<div class="sb_quicklink widget" id="quicklink"><h2>Quick Link</h2><div class="sb_quicklink_inner">';
	tmpHtml += '<ul>';
	l = quickLinkArray.length;
	for (var i=0; i < l; i++) {
		var item =  quickLinkArray[i];		
		tmpHtml += '  <li><a id="qu'+i+'" title="'+ item.caption+'" href="'+path+item.link +'"'+isCurrentStr+' target="'+item.target+'">'+ item.caption +'</a></li>';
	}
	tmpHtml += '</ul>';
	tmpHtml += '  </div></div>';
	tmpHtml += '  <!-- End of sb_quicklink -->';	

}
var e = document.getElementById('sidebar1');
if (e) {
	e.innerHTML = tmpHtml;
}
}

function buildSideBar() {
	if (!(section == '0')) {
		buildSideNav();
		return;
	}
	/* type1 , no sidebar */
	var tmpHtml = '';
	tmpHtml += ' <div class="widget" id="sb-brochure">';
	tmpHtml += ' </div>';
	tmpHtml += ' <div class="widget last" id="sb-last">&nbsp;</div>';
	var e = document.getElementById('sidebar2');
	if (e) {
		e.innerHTML = tmpHtml;
	}
}
function buildShareBox() {
	return;
}
function buildBottom() {
	var tmpHtml = '';
	var showHideDiv = '';
	if (section == 3 && false) {
		showHideDiv = ' style="display:none;" ';
	}
	tmpHtml += '	<div class="backtotop"><a href="#root"><i>Back to Top</i></a></div>';
	tmpHtml += '	<div id="footerlogo">';
	tmpHtml += '		<a href="'+path+'index.html" title="Home"><img src="'+path+'images/common/imagi_logo_footer.png" /></a>';
	tmpHtml += '	</div>';
	tmpHtml += '	<div id="copyright">';
	tmpHtml += '		<p>&copy; Imagi Intellectual Properties Limited or<br /> &copy; Imagi IP Ltd or<br />&copy; Imagi. All Rights Reserved.</p>';
	tmpHtml += '	</div>';
	tmpHtml += '    <div id="cc_10_11">';
	tmpHtml += '		<img src="'+path+'images/common/cclogo10_11_bw.png">';
	tmpHtml += '	</div>';
	tmpHtml += '    <div id="footernav">';
	tmpHtml += '    <a target="_self" href="'+path+'home/career.php" title="Career">Career</a> |';
	tmpHtml += '    <a target="_self" href="'+path+'home/contact-us.html" title="Contact Us">Contact Us</a> |';
	tmpHtml += '    <a target="_self" href="'+path+'home/terms-of-use.html" title="Terms of Use">Terms of Use</a> |';
	tmpHtml += '    <a target="_self" href="'+path+'home/privacy-policy.html" title="Privacy Policy">Privacy Policy</a>';
	tmpHtml += '    </div>';
	var e = document.getElementById('footer');
	if (e) {
		e.innerHTML = tmpHtml;
	}
}

function preloadimages() { 
return;
 if (document.images) { preload_image_object = new Image(); 
 image_url = []; image_url[0] = path+'images/common/sb-contact_h1_on.png';
 image_url[1] = path+'images/common/sb-downloads_h1_on.png'; image_url[2] = path+'images/common/sb-catalogue_h1_on.png'; image_url[3] = path+'images/common/sb-visitus_h1_on.png'; 
 var i = 0; for(i=0; i<=3; i++) preload_image_object.src = image_url[i];} 
}

if (section == '2') {
	if (!window.level) {
		window.level = 0;
		var level = 0;
	}
}

/*** Contact us Form  *******************************************************************/
function validateEmail(address) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;  
   if(reg.test(address) == false) {      
      return false;
   }
   return true;
}
function resetAllErr() {
	var e = document.getElementById('usernameerr');
	e.className = "missinghide";
	e = document.getElementById('emailerr');
	e.className = "missinghide";
	e = document.getElementById('telerr');
	e.className = "missinghide";	
	e = document.getElementById('countryerr');
	e.className = "missinghide";	
	e = document.getElementById('subjecterr');
	e.className = "missinghide";	
	e = document.getElementById('msgerr');
	e.className = "missinghide";	
}
function resetAllErr2() {
	var e = document.getElementById('usernameerr');
	e.className = "missinghide";
	e = document.getElementById('emailerr');
	e.className = "missinghide";
	e = document.getElementById('telerr');
	e.className = "missinghide";	
	e = document.getElementById('add1err');
	e.className = "missinghide";
	e = document.getElementById('cityerr');
	e.className = "missinghide";
	e = document.getElementById('countryerr');
	e.className = "missinghide";
}
function showError(elemStr) {
	var e = document.getElementById(elemStr);
	e.className = "missing";	
}
function get_time()
{
	var d = new Date();
	var t_date = d.getDate();     
	var t_mon = 1+d.getMonth();     
	var t_year = d.getFullYear();
	var c_hour = d.getHours();
	var c_min = d.getMinutes();
	var c_sec = d.getSeconds();
   var t = t_year +"-"+ t_mon +"-" + t_date + " " + c_hour + ":" + c_min + ":" + c_sec;
   return t;
}
function checking(){
	boolid=true;
	boolpwd=true;
	resetAllErr();
	if (document.formcontact.username.value=="") {
	   	showError('usernameerr');
		 document.formcontact.username.focus();
		 return false;
	}
	if (document.formcontact.email.value=="" || !validateEmail(document.formcontact.email.value)) {
   	   	 showError('emailerr');
		 document.formcontact.email.focus();
		 return false;
	}
	if (document.formcontact.tel.value=="") {
	   	   	showError('telerr');
		 document.formcontact.tel.focus();
		 return false;
	}
	if (document.formcontact.country.value=="") {
	   	   	showError('countryerr');
		 document.formcontact.country.focus();
		 return false;
	}
//	if (document.formcontact.subject.value=="") {
//	   	   	showError('subjecterr');
//		 document.formcontact.subject.focus();
//		 return false;
//	}
	if (document.formcontact.msg.value=="") {
	   	   	showError('msgerr');
		 document.formcontact.msg.focus();
		 return false;
	}
	if (boolid && boolpwd) {
		document.formcontact.clienttime.value = get_time();		
		document.formcontact.submit();
	}
}
/** Checking 2 is for validate get mailed catalogue **/
function checking2(){
	boolid=true;
	boolpwd=true;
	resetAllErr2();
	if (document.formcontact.username.value=="") {
	   	showError('usernameerr');
		 document.formcontact.username.focus();
		 return false;
	}
	if (document.formcontact.email.value=="" || !validateEmail(document.formcontact.email.value)) {
   	   	 showError('emailerr');
		 document.formcontact.email.focus();
		 return false;
	}
	if (document.formcontact.tel.value=="") {
	   	   	showError('telerr');
		 document.formcontact.tel.focus();
		 return false;
	}
	if (document.formcontact.add1.value=="") {
	   	   	showError('add1err');
		 document.formcontact.add1.focus();
		 return false;
	}
	if (document.formcontact.city.value=="") {
	   	   	showError('cityerr');
		 document.formcontact.city.focus();
		 return false;
	}
	if (document.formcontact.country.value=="") {
	   	   	showError('countryerr');
		 document.formcontact.country.focus();
		 return false;
	}
	
	if (boolid && boolpwd) {
		document.formcontact.clienttime.value = get_time();	
		document.formcontact.submit();
	}
}

/*** End of Contact us Form  *******************************************************************/
//if (isIE && document.execCommand)	document.execCommand('BackgroundImageCache', false, true);

function GetParam(name)
{
	var start=location.search.indexOf("?"+name+"=");
	if (start<0) start=location.search.indexOf("&"+name+"=");
 	if (start<0) return '';
 	start += name.length+2;
 	var end=location.search.indexOf("&",start)-1;
 	if (end<0) end=location.search.length;
 	var result=location.search.substring(start,end);
 	var result='';
 	for(var i=start;i<=end;i++)
 	{
 		var c=location.search.charAt(i);
 		result=result+(c=='+'?' ':c);
 	}
 	//alert(unescape(result));
 	return unescape(result);
}
$(document).ready(function() {
	buildMainScreen();
	buildTop();
	buildSideBar();	
	//buildFeatureBar();
	buildBottom();
	//buildHomeSocialWidget();
	buildBread();
	//buildProductPageTab();
	//preloadimages();
	
	$('a[href*=#]').click(function() { 
	  if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { 
		var $target = $(this.hash); 
		$target = $target.length && $target 
		|| $('[name=' + this.hash.slice(1) +']'); 
		if ($target.length) { 
		  var targetOffset = $target.offset().top-100; 
		   $('html, body').animate({scrollTop: targetOffset}, 1000); 
		 return false; 
		} 
	  } 
	}); 
	
});

function clearInput(field_id, term_to_clear) {
	if (document.getElementById(field_id).value == term_to_clear ) {
		document.getElementById(field_id).value = '';
	}
	else if (document.getElementById(field_id).value == '' ) {
		document.getElementById(field_id).value = term_to_clear;
	}
}


