﻿document.title="Hallmarkbabies";

function Menu() {
	this.contentId = 0;
	this.text = "";
	this.alt = "";
	this.href = "";
	this.hrefTextOnly = "";
	this.target = "";
	//this.liClass = "";
	this.childs = new Array();
	this.addChild = function(m) {
		this.childs[this.childs.length] = m;
	}
}

function getPath(){
	var langs = ['en', 'tc', 'sc', 'hr', 'ru', 'my'];
	var currentLang = langs[0];
	for(x in langs){
		if(location.href.search("/"+langs[x]+"/")!=-1){
			currentLang = langs[x];
		}
	}
	return [location.href.substr(0, location.href.search('/'+currentLang+'/')), currentLang];
}
var temp = getPath();
var currentPath = temp[0];
var currentLang = temp[1];
var currentPathLang = temp[0] + '/' + temp[1] + '/';

function SwitchLang(charsetID){
	var url = window.location.toString();
	var isStaticURL = false;
	var langPaths = new Array("en", "tc", "sc", "hr", "ru", "my");
	var oldLangPath = "";

	// Check url type (is static page or dynamic page)
	for (i=0; i < langPaths.length; i++){
		if (url.indexOf("/"+langPaths[i]+"/") != -1){
			oldLangPath = "/"+langPaths[i]+"/";
			isStaticURL = true;
			break;
		}
	}

	if (isStaticURL){
		var path = window.location.href;
		window.location = path.replace(oldLangPath, "/"+langPaths[charsetID - 1]+"/");
	}else{
		if (url.indexOf("lang=") != -1){
			window.location = 
				url.replace(/lang=\d/, "lang="+charsetID);
		}
	}
}

function zmsGenerateSectionImage(imgid) {
	if (typeof sectionImage!='undefined') {

		var thisSectionImage = '';

//		for(var i=sectionImage.length-1;i>0;i--){
		for(var i=0;i<sectionImage.length;i++){
			if(sectionImage[i][imgid]!==""){
				thisSectionImage = sectionImage[i][imgid];
				break;
			}
		}
		return thisSectionImage;
		//document.write('<img src="'+thisSectionImage+'" border="0" />');
	}
}

function checkEmail(email) {
	var filter = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
	if (!filter.test(email)) {
/*		alert('Please provide a valid email address');
		email.focus*/
		return false;
	}
	return true;
}

function getQueryVariable(variable) {
	var query = window.location.search.substring(1);
	var vars = query.split("&");
	
	for (var i=0;i<vars.length;i++){
		var pair = vars[i].split("=");
		if (pair[0] == variable) {
			return pair[1];
		}
	} 
}

$(document).ready(function(){
	try{
		
			if(zmsBreadcrumbParentList[1] == '1'){
				ml = "1";
			}else if(zmsBreadcrumbParentList[1] == '6'){
				ml = "2";
			}else if(zmsBreadcrumbParentList[1] == '18'){
				ml = "3";
			}else{
				
			}
			$('#subm'+ml).css('display','block');
	}catch(e){};
	
});
